Merge pull request #1353 from ostcar/django17

Updated Django version to 1.7.
This commit is contained in:
Norman Jäckel 2014-10-17 19:27:56 +02:00
commit 087a5f1650
8 changed files with 19 additions and 17 deletions

View File

@ -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)
==========================

View File

@ -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"))

View File

@ -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):

View File

@ -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

View File

@ -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')

View File

@ -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

View File

@ -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

View File

@ -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