Some last (template) improvements for next release

- Added dataTable function for group overview table.
- Added default form help text for groups and an explanation for group overview table.
- Updated translation.
- Translate group name in form.
- Username: FirstName instead of First_Name
- Hide group 'registered' from UserForm
- Linked persons/candidates/submitter etc. to UserView
- Fixed permissions in template

Translation
This commit is contained in:
Emanuel Schuetze 2013-05-15 23:26:24 +02:00
parent e76aa499f3
commit b5a5acbf2c
18 changed files with 483 additions and 483 deletions

View File

@ -2,6 +2,7 @@
{% load i18n %}
{% load staticfiles %}
{% load tags %}
{% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}"{% endblock %}
@ -18,36 +19,32 @@
{{ assignment }}
<small class="pull-right">
<a href="{% url 'assignment_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<a href="{% url 'print_assignment' assignment.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print election as PDF' %}"><i class="icon-print"></i> PDF</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show election' %}">
<i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.assignment.can_manage_assignment or perms.agenda.can_manage_agenda %}
<div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %}
<span class="caret"></span>
<a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} <span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
<li><a href="{% url 'assignment_edit' assignment.id %}"><i class="icon-pencil"></i> {% trans 'Edit election' %}</a></li>
<!-- delete -->
<li><a href="{% url 'assignment_delete' assignment.id %}"><i class="icon-remove"></i> {% trans 'Delete election' %}</a></li>
<!-- edit poll -->
{% if perms.assignment.can_manage_assignment %}
{% for poll in motion.polls %}
<li><a href="{% url 'assignment_poll_view' poll.id %}"><i class="icon-edit"></i> {{ forloop.counter }}. {% trans "Ballot" %}</a></li>
{% endfor %}
<!-- edit -->
<li><a href="{% url 'assignment_edit' assignment.id %}"><i class="icon-pencil"></i> {% trans 'Edit election' %}</a></li>
<!-- delete -->
<li><a href="{% url 'assignment_delete' assignment.id %}"><i class="icon-remove"></i> {% trans 'Delete election' %}</a></li>
{% endif %}
<!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %}
<li>
<a href="{% url 'assignment_create_agenda' assignment.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a>
</li>
<li><a href="{% url 'assignment_create_agenda' assignment.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}
</small>
</h1>
@ -67,7 +64,7 @@
<ol>
{% for person in assignment.get_participants %}
<li>
{{ person }}
<a href="{% model_url person 'view' %}">{{ person }}</a>
{% if perms.assignment.can_manage_assignment %}
{% if assignment.status == "sea" or assignment.status == "vot" %}
<a href="{% url 'assignment_delother' assignment.id person.person_id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Remove candidate' %}"><i class="icon-remove"></i></a>
@ -126,7 +123,7 @@
<ul>
{% for person in blocked_candidates %}
<li>
{{ person }}
<a href="{% model_url person 'view' %}">{{ person }}</a>
<a class="btn btn-mini" href="{% url 'assignment_delother' assignment.id person.person_id %}" title="{% trans 'Remove candidate' %}">
<i class="icon-ban-circle"></i>
</a>
@ -196,7 +193,7 @@
<a class="election_link" href="{% url 'assignment_user_elected' assignment.id candidate.person_id %}"></a>
{% endif %}
{% endif %}
{{ candidate }}
<a href="{% model_url candidate 'view' %}">{{ candidate }}</a>
</td>
{% for vote in poll_list %}
<td style="white-space:nowrap;">

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenSlides 1.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-23 16:17+0200\n"
"POT-Creation-Date: 2013-05-16 00:15+0200\n"
"PO-Revision-Date: 2012-07-28 11:07+0200\n"
"Last-Translator: Emanuel Schütze <emanuel@intevation.de>\n"
"Language: de\n"
@ -205,26 +205,26 @@ msgstr "Aktuelle Zeit"
msgid "Close"
msgstr "Schließen"
#: agenda/static/javascript/agenda.js:27
#: agenda/static/javascript/agenda.js:17
#, c-format
msgid ", of which %s are hidden."
msgstr ", davon %s verborgen."
#: static/javascript/dataTables.bootstrap.js:19
msgid "_MENU_ participants per page"
msgstr "_MENU_ Teilnehmer/innen pro Seite"
msgid "_MENU_ entries per page"
msgstr "_MENU_ Einträge pro Seite"
#: static/javascript/dataTables.bootstrap.js:20
msgid "Search:"
msgstr "Suche:"
#: static/javascript/dataTables.bootstrap.js:21
msgid "Showing _START_ to _END_ of _TOTAL_ participants"
msgstr "_START_ bis _END_ von _TOTAL_ Teilnehmer/innen"
msgid "Showing _START_ to _END_ of _TOTAL_ entries"
msgstr "_START_ bis _END_ von _TOTAL_ Einträgen"
#: static/javascript/dataTables.bootstrap.js:22
msgid "Showing 0 participants"
msgstr "0 Teilnehmer/innen"
msgid "Showing 0 entries"
msgstr "0 Einträge"
#: static/javascript/dataTables.bootstrap.js:23
msgid "(filtered from _MAX_ total entries)"
@ -234,18 +234,18 @@ msgstr "(gefiltert von _MAX_ Einträgen)"
msgid "No matching records found"
msgstr "Keine passenden Einträge gefunden"
#: static/javascript/dataTables.bootstrap.js:25
#: static/javascript/dataTables.bootstrap.js:26
msgid "First"
msgstr "Erster"
#: static/javascript/dataTables.bootstrap.js:26
#: static/javascript/dataTables.bootstrap.js:27
msgid "Last"
msgstr "Letzter"
#: static/javascript/dataTables.bootstrap.js:27
#: static/javascript/dataTables.bootstrap.js:28
msgid "Next"
msgstr "Weiter"
#: static/javascript/dataTables.bootstrap.js:28
#: static/javascript/dataTables.bootstrap.js:29
msgid "Previous"
msgstr "Zurück"

View File

@ -30,7 +30,7 @@
<td>{{ mediafile.filetype }}</td>
<td>{{ mediafile.get_filesize }}</td>
<td>{{ mediafile.timestamp }}</td>
<td>{{ mediafile.uploader }}</td>
<td><a href="{% model_url mediafile.uploader 'view' %}">{{ mediafile.uploader }}</a></td>
{% if perms.mediafile.can_manage %}
<td>
<span style="width: 1px; white-space: nowrap;">

View File

@ -20,38 +20,37 @@
{% trans "Version" %} {{ motion.version.version_number }}
</small>
<small class="pull-right">
<div class="btn-toolbar">
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print this motion as PDF' %}"><i class="icon-print"></i> PDF</a>
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print motion as PDF' %}"><i class="icon-print"></i> PDF</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show motion' %}">
<i class="icon-facetime-video {% if motion.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.motion.can_manage_motion or perms.agenda.can_manage_agenda %}
<div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %}
<span class="caret"></span>
<a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} <span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
{% if allowed_actions.edit %}
<li><a href="{% model_url motion 'edit' %}"><i class="icon-pencil"></i> {% trans 'Edit motion' %}</a></li>
{% endif %}
<!-- delete -->
{% if allowed_actions.delete %}
<li><a href="{% model_url motion 'delete' %}"><i class="icon-remove"></i> {% trans 'Delete motion' %}</a></li>
{% if perms.motion.can_manage_motion %}
<!-- edit -->
{% if allowed_actions.edit %}
<li><a href="{% model_url motion 'edit' %}"><i class="icon-pencil"></i> {% trans 'Edit motion' %}</a></li>
{% endif %}
<!-- delete -->
{% if allowed_actions.delete %}
<li><a href="{% model_url motion 'delete' %}"><i class="icon-remove"></i> {% trans 'Delete motion' %}</a></li>
{% endif %}
{% endif %}
<!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %}
<li>
<a href="{% url 'motion_create_agenda' motion.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a>
</li>
<li><a href="{% url 'motion_create_agenda' motion.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a></li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
</small>
</h1>
@ -166,7 +165,7 @@
<!-- Submitter -->
<h5>{% trans "Submitter" %}:</h5>
{% for submitter in motion.submitter.all %}
{{ submitter.person }}{% if not forloop.last %}, {% endif %}
<a href="{% model_url submitter.person 'view' %}">{{ submitter }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
<!-- Supporters -->
@ -177,7 +176,7 @@
{% else %}
<ol>
{% for supporter in motion.supporter.all %}
<li>{{ supporter }}</li>
<li><a href="{% model_url supporter.person 'view' %}">{{ supporter }}</a></li>
{% endfor %}
</ol>
{% endif %}

View File

@ -35,7 +35,7 @@ def gen_username(first_name, last_name):
"""
generates the username for new users.
"""
testname = "%s_%s" % (first_name.strip(), last_name.strip())
testname = "%s%s" % (first_name.strip(), last_name.strip())
try:
User.objects.get(username=testname)
except User.DoesNotExist:
@ -43,7 +43,7 @@ def gen_username(first_name, last_name):
i = 0
while True:
i += 1
testname = "%s_%s_%s" % (first_name, last_name, i)
testname = "%s%s%s" % (first_name, last_name, i)
try:
User.objects.get(username=testname)
except User.DoesNotExist:
@ -110,6 +110,6 @@ def import_users(csv_file):
def get_registered_group():
"""
Returns the Group 'Registered'. Upper and lower case is possible.
Returns the group 'Registered' (pk=2).
"""
return Group.objects.get(name__iexact='Registered')
return Group.objects.get(pk=2)

View File

@ -22,17 +22,12 @@ from openslides.participant.models import User, Group
from openslides.participant.api import get_registered_group
class UserCreateForm(forms.ModelForm, CssClassMixin):
groups = forms.ModelMultipleChoiceField(
queryset=Group.objects.exclude(name__iexact='anonymous'),
label=ugettext_lazy('Groups'), required=False)
def __init__(self, *args, **kwargs):
if kwargs.get('instance', None) is None:
initial = kwargs.setdefault('initial', {})
registered = get_registered_group()
initial['groups'] = [registered.pk]
super(UserCreateForm, self).__init__(*args, **kwargs)
class UserCreateForm(CssClassMixin, forms.ModelForm):
groups = LocalizedModelMultipleChoiceField(
# Hide the built-in groups 'Anonymous' (pk=1) and 'Registered' (pk=2)
queryset=Group.objects.exclude(pk=1).exclude(pk=2),
label=ugettext_lazy('Groups'), required=False,
help_text=ugettext_lazy('Hold down "Control", or "Command" on a Mac, to select more than one.'))
class Meta:
model = User
@ -109,21 +104,6 @@ class GroupForm(forms.ModelForm, CssClassMixin):
return instance
def clean_name(self):
# Do not allow to change the name "anonymous" or give another group
# this name
data = self.cleaned_data['name']
if self.instance.name.lower() in ['anonymous', 'registered']:
# Editing the anonymous-user
if self.instance.name.lower() != data.lower():
raise forms.ValidationError(
_('You can not edit the name for this group.'))
else:
if data.lower() in ['anonymous', 'registered']:
raise forms.ValidationError(
_('Group name "%s" is reserved for internal use.') % data)
return data
class Meta:
model = Group

View File

@ -9,7 +9,26 @@
<h1>{% trans group.name %}
<small class="pull-right">
<a href="{% url 'user_group_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<a href="{% url 'user_group_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show group' %}">
<i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.participant.can_manage_participant and group.pk != 1 and group.pk != 2 %}
<div class="btn-group">
<a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} <span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
<li><a href="{% url 'user_group_edit' group.id %}"><i class="icon-pencil"></i> {% trans 'Edit group' %}</a></li>
<!-- delete -->
<li><a href="{% url 'user_group_delete' group.id %}"><i class="icon-remove"></i> {% trans 'Delete group' %}</a></li>
</ul>
</div>
{% endif %}
</small>
</h1>
@ -19,7 +38,7 @@
<ol>
{% for member in group_members %}
<li>{{ member }}</li>
<li><a href="{% model_url member 'view' %}">{{ member }}</a></li>
{% empty %}
<p>{% trans "No members available." %}</p>
{% endfor %}

View File

@ -1,25 +1,44 @@
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load tags %}
{% block title %}{{ block.super }} {% trans "Groups" %}{% endblock %}
{% block header %}
<link href="{% static 'styles/dataTables/dataTables.bootstrap.css' %}" type="text/css" rel="stylesheet">
{% endblock %}
{% block javascript %}
<script src="{% static 'javascript/jquery.dataTables.min.js' %}" type="text/javascript"></script>
<script src="{% static 'javascript/dataTables.bootstrap.js' %}" type="text/javascript"></script>
{% endblock %}
{% block content %}
<h1>{% trans "Groups" %}
<h1>
{% trans "Groups" %}
<small class="pull-right">
<a href="{% url 'user_group_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New group' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to participants overview" %}</a>
</small>
</h1>
<table class="table table-striped table-bordered">
<table id="dataTable" class="table table-striped table-bordered">
<thead>
<tr>
<th class="mini_width">{% trans "ID" %}</th>
<th>{% trans "Group" %}</th>
<th style="width: 1px;">{% trans "Actions" %}</th>
<th class="mini_width">{% trans "Actions" %}</th>
</tr>
</thead>
{% for group in groups %}
<tr class="{% if group.active %}activeline{% endif %}">
<td class="nobr">{{ group.pk }}
{% if group.pk == 1 or group.pk == 2 %}
<a title="{% blocktrans %}The groups 1 ('Anonymous') and 2 ('Registered') are fixed default groups which can not be deleted. Each created or imported participant is a member of group 2. Use custom groups to set additional permissions for a subset of participants.{% endblocktrans %}"><i class="icon-info-sign"></i></a>
{% endif %}
</td>
<td>
<a href="{% model_url group 'view' %}">{% trans group.name %}</a>
</td>
@ -33,7 +52,7 @@
<a href="{% url 'user_group_edit' group.id %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<i class="icon-pencil"></i>
</a>
{% if group.name|lower != 'anonymous' and group.name|lower != 'registered' %}
{% if group.pk != 1 and group.pk != 2 %}
<a href="{% url 'user_group_delete' group.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i>
</a>

View File

@ -3,7 +3,7 @@
<ul style="line-height: 180%">
{% for group in groups %}
{% if group.name != 'Anonymous' and group.name != 'Registered' %}
{% if group.pk != 1 and group.pk != 2 %}
<li class="{% if group.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i>

View File

@ -22,7 +22,6 @@
</li>
<li>
{% trans 'Default groups' %}:
{% trans 'Anonymous' %} (<code>1</code>), {% trans 'Registered' %} (<code>2</code>),
{% trans 'Delegate' %} (<code>3</code>), {% trans 'Staff' %} (<code>4</code>)
</li>
<li>{% trans 'Required CSV file encoding: UTF-8 (Unicode).' %}</li>

View File

@ -16,39 +16,28 @@
{% endblock %}
{% block content %}
<h1>{% trans "Participants" %}
<h1>
{% trans "Participants" %}
<small class="pull-right">
<div class="btn-toolbar">
{% if perms.participant.can_manage_participant %}
<a href="{% url 'user_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New participant' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
<a href="{% url 'user_group_overview' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'All groups' %}"><i class="icon-group"></i> {% trans "Groups" %}</a>
<a href="{% url 'user_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import participants' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>
{% endif %}
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
<div class="btn-group pull-right">
{% if user.is_authenticated %}
<a href="#" data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
<i class="icon-print"></i> PDF
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% url 'user_settings' as url_usersettings %}
<li><a href="{% url 'user_print' %}"><i class="icon-list"></i> {% trans 'List of participants' %}</a></li>
<li><a href="{% url 'print_passwords' %}"><i class="icon-th-large"></i> {% trans 'First time passwords' %}</a></li>
</ul>
{% else %}
<a href="{% url 'user_login' %}" class="btn">{% trans "Login" %}</a>
{% endif %}
</div>
{% else %}
{% if perms.participant.can_see_participant %}
<a href="{% url 'user_print' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print list of participants as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
{% if perms.participant.can_manage_participant %}
<a href="{% url 'print_passwords' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print first time passwords as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
{% endif %}
</div>
{% if perms.participant.can_manage_participant %}
<a href="{% url 'user_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New participant' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
<a href="{% url 'user_group_overview' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'All groups' %}"><i class="icon-group"></i> {% trans "Groups" %}</a>
<a href="{% url 'user_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import participants' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>
{% endif %}
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
<div class="btn-group">
<a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
<i class="icon-print"></i> PDF <span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
{% url 'user_settings' as url_usersettings %}
<li><a href="{% url 'user_print' %}"><i class="icon-list"></i> {% trans 'List of participants' %}</a></li>
<li><a href="{% url 'print_passwords' %}"><i class="icon-th-large"></i> {% trans 'First time passwords' %}</a></li>
</ul>
</div>
{% else %}
<a href="{% url 'user_print' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print list of participants as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
</small>
</h1>
@ -92,7 +81,7 @@
<td class="optional">{{ user.structure_level }}</td>
<td class="optional">
{% for group in user.groups.all %}
{% if group.name != 'Registered' %}
{% if group.pk != 2 %}
{% trans group.name %}
{% if not forloop.last %}<br>{% endif %}
{% endif %}

View File

@ -7,9 +7,29 @@
{% block content %}
<h1>{{ shown_user.clean_name }}
<h1>
{{ shown_user.clean_name }}
<small class="pull-right">
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' shown_user.sid %}" class="activate_link btn {% if shown_user.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show participant' %}">
<i class="icon-facetime-video {% if shown_user.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.participant.can_manage_participant %}
<div class="btn-group">
<a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} <span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
<li><a href="{% url 'user_edit' shown_user.id %}"><i class="icon-pencil"></i> {% trans 'Edit participant' %}</a></li>
<!-- delete -->
<li><a href="{% url 'user_delete' shown_user.id %}"><i class="icon-remove"></i> {% trans 'Delete participant' %}</a></li>
</ul>
</div>
{% endif %}
</small>
</h1>

View File

@ -104,6 +104,17 @@ class UserCreateView(CreateView):
self.object.default_password = gen_password()
self.object.set_password(self.object.default_password)
def post_save(self, form):
super(UserCreateView, self).post_save(form)
# TODO: find a better solution that makes the following lines obsolete
# Background: motion.models.use_post_save adds already the registerd group
# to new user but super(..).post_save(form) removes it and sets only the
# groups selected in the form (without 'registered')
# workaround: add registered group again manually
from openslides.participant.api import get_registered_group # TODO: Test, if global import is possible
registered = get_registered_group()
self.object.groups.add(registered)
class UserUpdateView(UpdateView):
"""
@ -190,7 +201,7 @@ class ParticipantsListPDF(PDFView):
counter += 1
groups = ''
for group in user.groups.all():
if unicode(group) != "Registered":
if group.pk != 2:
groups += "%s<br/>" % unicode(group)
data.append([
counter,
@ -400,7 +411,7 @@ class GroupDeleteView(DeleteView):
success_url_name = 'user_group_overview'
def pre_redirect(self, request, *args, **kwargs):
if self.get_object().name.lower() in ['anonymous', 'registered']:
if self.get_object().pk in [1, 2]:
messages.error(request, _("You can not delete this Group."))
else:
super(GroupDeleteView, self).pre_redirect(request, *args, **kwargs)

View File

@ -19,7 +19,7 @@ $(document).ready(function() {
"sLengthMenu": gettext("_MENU_ entries per page"),
"sSearch": gettext("Search:"),
"sInfo": gettext("Showing _START_ to _END_ of _TOTAL_ entries"),
"sInfoEmpty": gettext("Showing 0 participants"),
"sInfoEmpty": gettext("Showing 0 entries"),
"sInfoFiltered": gettext("(filtered from _MAX_ total entries)"),
"sZeroRecords": gettext("No matching records found"),
"oPaginate": {

View File

@ -27,7 +27,7 @@ class AnonymousAuth(object):
"""
Authenticate a user based in username / password.
- always return None as anonymous can't login..
- always return None as anonymous can't login.
"""
return None
@ -35,13 +35,13 @@ class AnonymousAuth(object):
"""
Return the permissions a user is graneted by his group membership(s).
- try to return the permissions for the 'Anonymous' group
- try to return the permissions for the 'Anonymous' group (pk=1).
"""
if (not user_obj.is_anonymous() or obj is not None or
not config['system_enable_anonymous']):
return set()
perms = Permission.objects.filter(group__name='Anonymous')
perms = Permission.objects.filter(group__pk=1)
if perms is None:
return set()
perms = perms.values_list('content_type__app_label', 'codename') \