some small fixes
This commit is contained in:
parent
5e6180a465
commit
3eeae673c0
@ -3,6 +3,7 @@
|
||||
\.pyc$
|
||||
\.swp$
|
||||
^openslides/settings\.py$
|
||||
^openslides/urls\.py$
|
||||
^database\.db$
|
||||
~$
|
||||
\.DS_Store$
|
||||
@ -11,5 +12,6 @@
|
||||
^dist/
|
||||
^versiontools
|
||||
|
||||
|
||||
syntax:glob
|
||||
*.egg-info
|
||||
|
@ -86,6 +86,8 @@ from openslides.utils.signals import template_manipulation
|
||||
|
||||
@receiver(template_manipulation, dispatch_uid="system_base_system")
|
||||
def set_submenu(sender, request, context, **kwargs):
|
||||
if sender.__class__.__module__ != 'system.views':
|
||||
return None
|
||||
selected = True if request.path == reverse('config_general') else False
|
||||
menu_links = [
|
||||
(reverse('config_general'), _('General'), selected),
|
||||
|
@ -26,7 +26,6 @@ from system.forms import SystemConfigForm, EventConfigForm
|
||||
from system import config
|
||||
|
||||
|
||||
|
||||
class GeneralConfig(FormView):
|
||||
permission_required = 'system.can_manage_system'
|
||||
form_class = EventConfigForm
|
||||
@ -97,4 +96,3 @@ def register_tab(request):
|
||||
permission=request.user.has_perm('system.can_manage_system'),
|
||||
selected=selected,
|
||||
)
|
||||
|
||||
|
@ -28,6 +28,7 @@ from django.views.generic import (
|
||||
CreateView as _CreateView,
|
||||
View as _View,
|
||||
FormView as _FormView,
|
||||
ListView as _ListView,
|
||||
)
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.utils.importlib import import_module
|
||||
@ -73,6 +74,13 @@ class TemplateView(PermissionMixin, _TemplateView):
|
||||
return context
|
||||
|
||||
|
||||
class ListView(PermissionMixin, _ListView):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ListView, self).get_context_data(**kwargs)
|
||||
template_manipulation.send(sender=self, request=self.request, context=context)
|
||||
return context
|
||||
|
||||
|
||||
class RedirectView(PermissionMixin, _RedirectView):
|
||||
permanent = False
|
||||
allow_ajax = False
|
||||
@ -124,14 +132,14 @@ class UpdateView(PermissionMixin, _UpdateView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(UpdateView, self).get_context_data(**kwargs)
|
||||
template_manipulation.send(sender=self, context=context)
|
||||
template_manipulation.send(sender=self, request=self.request, context=context)
|
||||
return context
|
||||
|
||||
|
||||
class CreateView(PermissionMixin, _CreateView):
|
||||
def get_success_url(self):
|
||||
if 'apply' in self.request.POST:
|
||||
return reverse('item_edit', args=[self.object.id])
|
||||
return reverse(self.get_apply_url(), args=[self.object.id])
|
||||
return reverse(super(CreateView, self).get_success_url())
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
@ -139,6 +147,10 @@ class CreateView(PermissionMixin, _CreateView):
|
||||
template_manipulation.send(sender=self, request=self.request, context=context)
|
||||
return context
|
||||
|
||||
def get_apply_url(self):
|
||||
#todo: Versuche apply url automatisch anhand on self.object herauszufindne
|
||||
return self.apply_url
|
||||
|
||||
|
||||
class DeleteView(RedirectView, SingleObjectMixin):
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user