Merge pull request #80 from ostcar/master

pep8, django1.5 and smal fix
This commit is contained in:
Oskar Hahn 2013-01-05 06:33:27 -08:00
commit ece772540f
11 changed files with 17 additions and 11 deletions

View File

@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
from openslides.agenda.views import (Overview, View, SetClosed, ItemUpdate,
ItemCreate, ItemDelete, AgendaPDF)

View File

@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
from openslides.assignment.views import (ViewPoll, AssignmentPDF,
AssignmentPollPDF, AssignmentPollDelete, CreateAgendaItem)

View File

@ -318,7 +318,7 @@ class AssignmentPollDelete(DeleteView):
return reverse('assignment_view', args=[self.assignment.id])
def get_success_message(self):
return _('Ballot was successfully deleted.') % self.object
return _('Ballot was successfully deleted.') % self.object
class AssignmentPDF(PDFView):

View File

@ -11,7 +11,7 @@
"""
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
from django.utils.importlib import import_module
from openslides.config.views import GeneralConfig, VersionConfig

View File

@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
from openslides.motion.views import (MotionDelete, ViewPoll,
MotionPDF, MotionPollPDF, CreateAgendaItem, SupportView)

View File

@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
from openslides.participant.views import (
UserOverview, UserCreateView, UserDetailView, UserUpdateView,

View File

@ -471,7 +471,7 @@ def login(request):
extra_content = {}
try:
admin = User.objects.get(pk=1)
if admin.check_password(admin.default_password):
if admin.check_password(admin.default_password):
extra_content['first_time_message'] = _(
"Installation was successfully! Use %(user)s "
"(password: %(password)s) for first login.<br>"

View File

@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
from openslides.projector.views import (DashboardView, ActivateView,
CustomSlideCreateView, CustomSlideUpdateView, CustomSlideDeleteView,

View File

@ -11,7 +11,7 @@
"""
from django.conf import settings
from django.conf.urls.defaults import patterns, url, include
from django.conf.urls import patterns, url, include
from django.utils.importlib import import_module
from openslides.utils.views import RedirectView

View File

@ -15,7 +15,7 @@ from django.template.loader_tags import BlockNode, ExtendsNode
class Tab(object):
def __init__(self, title='', url='', permission='', selected=False):
def __init__(self, title='', url='', permission=True, selected=False):
self.selected = False
self.title = title
self.permission = permission

View File

@ -241,6 +241,8 @@ class UpdateView(PermissionMixin, _UpdateView):
class CreateView(PermissionMixin, _CreateView):
apply_url = None
def get_success_url(self):
messages.success(self.request, self.get_success_message())
if 'apply' in self.request.POST:
@ -254,7 +256,11 @@ class CreateView(PermissionMixin, _CreateView):
return context
def get_apply_url(self):
return self.apply_url
if self.apply_url:
return self.apply_url
else:
raise ImproperlyConfigured(
"No URL to redirect to. Provide a apply_url.")
def form_invalid(self, form):
messages.error(self.request, _('Please check the form for errors.'))