Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #34 from emanuelschuetze/prepare-2.0.1
Browse files Browse the repository at this point in the history
Prepare 2.0.1
  • Loading branch information
emanuelschuetze authored Dec 20, 2016
2 parents fe81507 + 972ec3e commit 53e9eab
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 29 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ python:
- "3.4"
- "3.5"
install:
- "pip install --upgrade --requirement requirements.txt"
- "pip install flake8==2.5.4 isort==4.2.2"
- "pip install --upgrade setuptools"
- "pip install https://github.com/OpenSlides/OpenSlides/archive/e340d837775ca3853d119a75ebda922baf83c3c3.zip"
# - "pip install --upgrade --requirement requirements.txt"
- "pip install flake8==3.0.4 isort==4.2.5"
script:
- "flake8 openslides_csv_export tests"
- "isort --check-only --recursive openslides_csv_export tests"
Expand Down
10 changes: 8 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It is also useful as an example how to write plugins for OpenSlides.
Requirements
============

OpenSlides 2.0.x (https://openslides.org/)
OpenSlides 2.1.x (https://openslides.org/)


Install
Expand All @@ -37,7 +37,7 @@ plugin in it::

$ source .virtualenv/bin/activate

$ pip install "openslides>=2.0,<2.1" openslides-csv-export
$ pip install "openslides>=2.1,<2.2" openslides-csv-export

Start OpenSlides::

Expand All @@ -54,6 +54,12 @@ MIT License, see LICENSE file. The authors are mentioned in the AUTHORS file.
Changelog
=========

Next Version (unreleased)
-------------------------
* Updated to OpenSlides 2.1. Dropped support for OpenSlides 2.0.
* Added example how to use states and templates.


Version 2.0.0 (2016-04-23)
--------------------------
* Updated to OpenSlides 2.0. Dropped support for OpenSlides 1.x.
Expand Down
2 changes: 1 addition & 1 deletion openslides_csv_export/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__verbose_name__ = 'OpenSlides CSV Export Plugin'
__description__ = 'This plugin for OpenSlides provides a csv export of the lists of speakers.'
__version__ = '2.0.0'
__version__ = '2.1.0-dev'

default_app_config = 'openslides_csv_export.apps.CSVExportAppConfig'
7 changes: 4 additions & 3 deletions openslides_csv_export/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ class CSVExportAppConfig(AppConfig):
description = __description__
version = __version__
angular_site_module = True
angular_projector_module = False
angular_projector_module = False # TODO
js_files = [
'js/openslides_csv_export/base.js',
'js/openslides_csv_export/site.js']
'static/js/openslides_csv_export/base.js',
'static/js/openslides_csv_export/site.js',
]

def ready(self):
# Add plugin urlpatters to application configuration so OpenSlides
Expand Down
13 changes: 12 additions & 1 deletion openslides_csv_export/static/js/openslides_csv_export/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@ angular.module('OpenSlidesApp.openslides_csv_export.site', ['OpenSlidesApp.opens
'gettext',
function (mainMenuProvider, gettext) {
mainMenuProvider.register({
'ui_sref': 'csv_export_list_of_speakers',
'ui_sref': 'openslides_csv_export_overview',
'img_class': 'download',
'title': gettext('CSV Export'),
'weight': 2000,
'perm': 'agenda.can_manage',
});
}
])

.config([
'$stateProvider',
function ($stateProvider) {
$stateProvider
.state('openslides_csv_export_overview', {
url: '/openslides_csv_export',
templateUrl: 'static/templates/openslides_csv_export/overview.html',
});
}
]);

}());
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="header">
<div class="title">
<h1>CSV Export (<translate>List of speakers</translate>)</h1>
</div>
</div>

<div class="details">
<p>
<a href="/csv_export_lists_of_speakers/" target="_self" class="btn btn-primary btn-sm">
<i class="fa fa-download fa-lg"></i>
Download
</a>
</p>
</div>
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
openslides>=2.0,<2.1
openslides>=2.1,<2.2
50 changes: 37 additions & 13 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
"""
Settings file for tests only
Settings file tests.
"""

import os

from openslides.global_settings import * # noqa

# Path to the directory for user specific data files
OPENSLIDES_USER_DATA_PATH = os.path.realpath(os.path.dirname(__file__))

OPENSLIDES_USER_DATA_PATH = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))

# SECURITY WARNING: Keep the secret key used in production secret!
SECRET_KEY = 'secret'

# OpenSlides plugins

# Add plugins to this list.

INSTALLED_PLUGINS += (
INSTALLED_PLUGINS += ( # noqa
'openslides_csv_export',
)

INSTALLED_APPS += INSTALLED_PLUGINS
INSTALLED_APPS += INSTALLED_PLUGINS # noqa


# Important settings for production use
# https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/

SECRET_KEY = 'secret'

DEBUG = False


# Database
# Change this to use MySQL or PostgreSQL.
# See https://docs.djangoproject.com/en/1.7/ref/settings/#databases
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

# Change this setting to use e. g. PostgreSQL or MySQL.

DATABASES = {
'default': {
Expand All @@ -34,20 +42,36 @@
}


# Some other settings
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/

TIME_ZONE = 'Europe/Berlin'


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/

STATICFILES_DIRS.insert(0, os.path.join(OPENSLIDES_USER_DATA_PATH, 'static')) # noqa


# Files
# https://docs.djangoproject.com/en/1.10/topics/files/

MEDIA_ROOT = os.path.join(OPENSLIDES_USER_DATA_PATH, '')

STATICFILES_DIRS.insert(0, os.path.join(OPENSLIDES_USER_DATA_PATH, 'static'))

# Whoosh search library
# https://whoosh.readthedocs.io/en/latest/

SEARCH_INDEX = 'ram'


# Special test settings
# Special settings only for testing

TEST_RUNNER = 'openslides.utils.test.OpenSlidesDiscoverRunner'

# Use a faster password hasher.

PASSWORD_HASHERS = (
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
)
]
12 changes: 6 additions & 6 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import datetime
import time

from django.contrib.auth import get_user_model
from django.utils import timezone
from openslides.agenda.models import Speaker
from openslides.core.models import CustomSlide
from openslides.topics.models import Topic
from openslides.utils.test import TestCase


Expand All @@ -25,18 +25,18 @@ def test_get_normal_user(self):
self.assertEqual(response.status_code, 403)

def test_csv_content(self):
customslide = CustomSlide.objects.create(title='Iangohse5pae7eineeca')
speaker1 = Speaker.objects.add(self.admin, customslide.agenda_item)
topic = Topic.objects.create(title='Iangohse5pae7eineeca')
speaker1 = Speaker.objects.add(self.admin, topic.agenda_item)
response = self.client.get('/csv_export_lists_of_speakers/')
self.assertContains(response, 'Iangohse5pae7eineeca,{},'.format(str(self.admin)), status_code=200)
speaker1.begin_speech()
response = self.client.get('/csv_export_lists_of_speakers/')
text = 'Iangohse5pae7eineeca,{},{}'.format(
str(self.admin),
datetime.datetime.now().strftime('%d.%m.%Y %H:%M:%S'))
timezone.now().strftime('%d.%m.%Y %H:%M:%S'))
self.assertContains(response, text, status_code=200)
time.sleep(1)
speaker1.end_speech()
response = self.client.get('/csv_export_lists_of_speakers/')
text = ','.join((text, datetime.datetime.now().strftime('%d.%m.%Y %H:%M:%S')))
text = ','.join((text, timezone.now().strftime('%d.%m.%Y %H:%M:%S')))
self.assertContains(response, text, status_code=200)

0 comments on commit 53e9eab

Please sign in to comment.