added AjaxView
This commit is contained in:
parent
3eeae673c0
commit
497a8cdb70
@ -22,6 +22,7 @@
|
||||
<p>{%trans "Results of" %} {{ ballot }}. {%trans "Vote" %}</p>
|
||||
<i>-1 := {% trans 'majority' %}, -2 := {% trans 'undocumented' %}</i>
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
<span id="poll_id" style="display:none">{{ poll.id }}</span>
|
||||
<table class="table" style="width: auto;">
|
||||
<tr>
|
||||
<th>{% trans "Option" %}</th>
|
||||
|
@ -86,7 +86,7 @@ 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':
|
||||
if not request.path.startswith('/config/'):
|
||||
return None
|
||||
selected = True if request.path == reverse('config_general') else False
|
||||
menu_links = [
|
||||
|
@ -43,6 +43,7 @@ FREE_TO_GO = 'free to go'
|
||||
|
||||
View = _View
|
||||
|
||||
|
||||
class LoginMixin(object):
|
||||
@method_decorator(login_required)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
@ -81,6 +82,14 @@ class ListView(PermissionMixin, _ListView):
|
||||
return context
|
||||
|
||||
|
||||
class AjaxView(PermissionMixin, View):
|
||||
def get(self, request, *args, **kwargs):
|
||||
return HttpResponse(json.dumps(self.get_ajax_context(**kwargs)))
|
||||
|
||||
def get_ajax_context(self, **kwargs):
|
||||
return {}
|
||||
|
||||
|
||||
class RedirectView(PermissionMixin, _RedirectView):
|
||||
permanent = False
|
||||
allow_ajax = False
|
||||
|
Loading…
Reference in New Issue
Block a user