diff --git a/CHANGELOG b/CHANGELOG index b3a708f15..c3c13f20d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,8 @@ Version 2.0.0 (unreleased) ========================== - Changed supported Python version to >= 3.3 +- Used Django 1.7 as lowest requirement +- Refactoring of the participant app. Now called 'users' Version 1.6.1 (unreleased) ========================== diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 7e85602ee..460c86780 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -296,7 +296,7 @@ class AssignmentPoll(SlideMixin, RelatedModelMixin, CollectDefaultVotesMixin, option_class = AssignmentOption assignment = models.ForeignKey(Assignment, related_name='poll_set') - yesnoabstain = models.BooleanField() + yesnoabstain = models.BooleanField(default=False) description = models.CharField( max_length=79, null=True, blank=True, verbose_name=ugettext_lazy("Comment on the ballot paper")) diff --git a/openslides/core/models.py b/openslides/core/models.py index 82c1d6668..86b5a4783 100644 --- a/openslides/core/models.py +++ b/openslides/core/models.py @@ -1,13 +1,15 @@ from django.core.urlresolvers import reverse from django.db import models from django.utils.translation import ugettext_lazy, ugettext_noop -from django.contrib.auth import get_user_model +# TODO: activate the following line after using the apploader +# from django.contrib.auth import get_user_model from openslides.utils.models import AbsoluteUrlMixin from openslides.projector.models import SlideMixin # Imports the default user so that other apps can import it from here. -User = get_user_model() +# TODO: activate this with the new apploader +# User = get_user_model() class CustomSlide(SlideMixin, AbsoluteUrlMixin, models.Model): diff --git a/openslides/users/forms.py b/openslides/users/forms.py index 8a5d0bddf..ddecb6d71 100644 --- a/openslides/users/forms.py +++ b/openslides/users/forms.py @@ -1,8 +1,7 @@ from django import forms from django.conf import settings from django.contrib.auth.models import Permission -from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy +from django.utils.translation import ugettext as _, ugettext_lazy from openslides.config.api import config from openslides.utils.forms import (CssClassMixin, @@ -58,7 +57,7 @@ class UserUpdateForm(UserCreateForm): def __init__(self, *args, **kwargs): self.request = kwargs.pop('request') - return super(UserUpdateForm, self).__init__(*args, **kwargs) + return super().__init__(*args, **kwargs) def clean(self, *args, **kwargs): """ @@ -74,7 +73,7 @@ class UserUpdateForm(UserCreateForm): return super().clean(*args, **kwargs) -class GroupForm(forms.ModelForm, CssClassMixin): +class GroupForm(CssClassMixin, forms.ModelForm): permissions = LocalizedModelMultipleChoiceField( queryset=Permission.objects.all(), label=ugettext_lazy('Permissions'), required=False) @@ -83,6 +82,7 @@ class GroupForm(forms.ModelForm, CssClassMixin): class Meta: model = Group + fields = '__all__' def __init__(self, *args, **kwargs): # Take request argument diff --git a/openslides/utils/tornado_webserver.py b/openslides/utils/tornado_webserver.py index 2df4a1b82..d8c2c52b8 100644 --- a/openslides/utils/tornado_webserver.py +++ b/openslides/utils/tornado_webserver.py @@ -3,8 +3,7 @@ import posixpath from urllib.parse import unquote from django.conf import settings -from django.core.handlers.wsgi import WSGIHandler as Django_WSGIHandler -from django.utils.translation import ugettext as _ +from django.core.wsgi import get_wsgi_application from sockjs.tornado import SockJSRouter, SockJSConnection from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop @@ -72,14 +71,14 @@ def run_tornado(addr, port): # Print listening address and port to command line if addr == '0.0.0.0': - url_string = _("the machine's local ip address") + url_string = "the machine's local ip address" else: url_string = 'http://%s:%s' % (addr, port) # TODO: don't use print, use django logging - print(_("Starting OpenSlides' tornado webserver listening to %(url_string)s") % {'url_string': url_string}) + print("Starting OpenSlides' tornado webserver listening to %(url_string)s" % {'url_string': url_string}) # Setup WSGIContainer - app = WSGIContainer(Django_WSGIHandler()) + app = WSGIContainer(get_wsgi_application()) # Collect urls projectpr_socket_js_router = SockJSRouter(ProjectorSocketHandler, '/projector/socket') diff --git a/openslides/utils/views.py b/openslides/utils/views.py index d46922ad4..13a953cc4 100644 --- a/openslides/utils/views.py +++ b/openslides/utils/views.py @@ -9,8 +9,7 @@ from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.core.urlresolvers import reverse from django.http import (HttpResponse, HttpResponseRedirect) from django.utils.decorators import method_decorator -from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy +from django.utils.translation import ugettext as _, ugettext_lazy from django.views import generic as django_views from django.views.generic.detail import SingleObjectMixin from reportlab.lib.units import cm @@ -534,7 +533,7 @@ class PDFView(PermissionMixin, View): View to generate an PDF. """ - filename = _('undefined-filename') + filename = ugettext_lazy('undefined-filename') top_space = 3 document_title = None diff --git a/requirements_production.txt b/requirements_production.txt index f373f58ba..10962bda7 100644 --- a/requirements_production.txt +++ b/requirements_production.txt @@ -1,5 +1,5 @@ # Requirements for OpenSlides in production in alphabetical order -Django>=1.6,<1.7 +Django>=1.7,<1.8 beautifulsoup4>=4.1,<4.4 bleach>=1.4,<1.5 django-ckeditor-updated>=4.2.3,<4.3 diff --git a/tests/mediafile/tests.py b/tests/mediafile/tests.py index ae0239da2..0228f2701 100644 --- a/tests/mediafile/tests.py +++ b/tests/mediafile/tests.py @@ -8,7 +8,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.test.client import Client from openslides.mediafile.models import Mediafile -from openslides.core.models import User +from openslides.users.models import User from openslides.utils.test import TestCase