Insert new config var for sorting Users by first_name

This commit is contained in:
Norman Jäckel 2012-09-14 02:40:40 +02:00
parent f8d3390c78
commit f41fe87656
3 changed files with 8 additions and 1 deletions

View File

@ -113,3 +113,6 @@ class ConfigForm(forms.Form, CssClassMixin):
required=False, required=False,
label=_("Welcome text"), label=_("Welcome text"),
help_text=_("Printed in PDF of first time passwords only.")) help_text=_("Printed in PDF of first time passwords only."))
participant_sort_users_by_first_name = forms.BooleanField(
required=False,
label=_("Sort users by first name"))

View File

@ -177,6 +177,7 @@ def default_config(sender, key, **kwargs):
return { return {
'participant_pdf_system_url': 'http://example.com:8000', 'participant_pdf_system_url': 'http://example.com:8000',
'participant_pdf_welcometext': _('Welcome to OpenSlides!'), 'participant_pdf_welcometext': _('Welcome to OpenSlides!'),
'participant_sort_users_by_first_name': False,
}.get(key) }.get(key)

View File

@ -412,13 +412,16 @@ class Config(FormView):
def get_initial(self): def get_initial(self):
return { return {
'participant_pdf_system_url': config['participant_pdf_system_url'], 'participant_pdf_system_url': config['participant_pdf_system_url'],
'participant_pdf_welcometext': config['participant_pdf_welcometext']} 'participant_pdf_welcometext': config['participant_pdf_welcometext'],
'participant_sort_users_by_first_name': config['participant_sort_users_by_first_name']}
def form_valid(self, form): def form_valid(self, form):
config['participant_pdf_system_url'] = ( config['participant_pdf_system_url'] = (
form.cleaned_data['participant_pdf_system_url']) form.cleaned_data['participant_pdf_system_url'])
config['participant_pdf_welcometext'] = ( config['participant_pdf_welcometext'] = (
form.cleaned_data['participant_pdf_welcometext']) form.cleaned_data['participant_pdf_welcometext'])
config['participant_sort_users_by_first_name'] = (
form.cleaned_data['participant_sort_users_by_first_name'])
messages.success( messages.success(
self.request, self.request,
_('Participants settings successfully saved.')) _('Participants settings successfully saved.'))