diff --git a/initial_data.json b/initial_data.json index ad17d7a56..5f7c8e30c 100644 --- a/initial_data.json +++ b/initial_data.json @@ -1,6 +1,6 @@ [ { - "pk": 2, + "pk": 1, "model": "auth.group", "fields": { "name": "Beobachter", @@ -38,7 +38,7 @@ [ "can_see_participant", "participant", - "openslidesuser" + "user" ], [ "can_see_projector", @@ -49,7 +49,7 @@ } }, { - "pk": 3, + "pk": 2, "model": "auth.group", "fields": { "name": "Delegierter", @@ -92,7 +92,7 @@ [ "can_see_participant", "participant", - "openslidesuser" + "user" ], [ "can_see_projector", @@ -103,7 +103,7 @@ } }, { - "pk": 4, + "pk": 3, "model": "auth.group", "fields": { "name": "Versammlungsleitung", @@ -161,12 +161,12 @@ [ "can_manage_participant", "participant", - "openslidesuser" + "user" ], [ "can_see_participant", "participant", - "openslidesuser" + "user" ], [ "can_manage_projector", @@ -182,7 +182,7 @@ } }, { - "pk": 5, + "pk": 4, "model": "auth.group", "fields": { "name": "Teilnehmerverwaltung", @@ -195,12 +195,12 @@ [ "can_manage_participant", "participant", - "openslidesuser" + "user" ], [ "can_see_participant", "participant", - "openslidesuser" + "user" ], [ "can_see_projector", diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 9e5f69ac3..cab549e83 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -54,7 +54,7 @@ class Overview(TemplateView): context = self.get_context_data(**kwargs) if not request.user.has_perm('agenda.can_manage_agenda'): messages.error(request, - _('You are not permitted to manage the agenda.')) + _('You are not authorized to manage the agenda.')) return self.render_to_response(context) transaction.commit() for item in Item.objects.all(): @@ -167,69 +167,24 @@ class ItemDelete(DeleteView): model = Item url = 'item_overview' - def pre_post_redirect(self, request, *args, **kwargs): - self.object = self.get_object() + def get_answer_options(self): + if self.object.children.exists(): + return [('all', _("Yes, with all child items."))] + self.answer_options + else: + return self.answer_options - if 'all' in request.POST: + def pre_post_redirect(self, request, *args, **kwargs): + if self.get_answer() == 'all': self.object.delete(with_children=True) messages.success(request, _("Item %s and his children were successfully deleted.") \ % html_strong(self.object)) - else: + elif self.get_answer() == 'yes': self.object.delete(with_children=False) messages.success(request, _("Item %s was successfully deleted.") \ % html_strong(self.object)) - def gen_confirm_form(self, request, message, url, singleitem=False): - if singleitem: - messages.warning( - request, - """ - %s -
- - - -
- """ - % (message, url, csrf(request)['csrf_token'], _("Yes"), - _("No")) - ) - else: - messages.warning( - request, - """ - %s -
- - - - -
- """ - % (message, url, csrf(request)['csrf_token'], _("Yes"), - _("Yes, with all child items."), _("No")) - ) - - def confirm_form(self, request, object, item=None): - if item is None: - item = object - if item.get_children(): - self.gen_confirm_form( - request, - _('Do you really want to delete %s?') % html_strong(item), - item.get_absolute_url('delete'), - False, - ) - else: - self.gen_confirm_form( - request, - _('Do you really want to delete %s?') % html_strong(item), - item.get_absolute_url('delete'), - True, - ) - class AgendaPDF(PDFView): """ diff --git a/openslides/application/forms.py b/openslides/application/forms.py index 963e0f531..a6cc0bfad 100644 --- a/openslides/application/forms.py +++ b/openslides/application/forms.py @@ -51,16 +51,16 @@ class ApplicationImportForm(forms.Form, CssClassMixin): ) import_permitted = forms.BooleanField( required=False, - label=_("Import applications with status \"permitted\""), - help_text=_('Set the initial status for each application to ' - '"permitted"'), + label=_("Import motions with status \"authorized\""), + help_text=_('Set the initial status for each motion to ' + '"authorized"'), ) class ConfigForm(forms.Form, CssClassMixin): application_min_supporters = forms.IntegerField( widget=forms.TextInput(attrs={'class':'small-input'}), - label=_("Number of (minimum) required supporters for a application"), + label=_("Number of (minimum) required supporters for a motion"), initial=4, min_value=0, max_value=8, @@ -69,7 +69,7 @@ class ConfigForm(forms.Form, CssClassMixin): application_preamble = forms.CharField( widget=forms.TextInput(), required=False, - label=_("Application preamble") + label=_("Motion preamble") ) application_pdf_ballot_papers_selection = forms.ChoiceField( widget=forms.Select(), @@ -90,17 +90,17 @@ class ConfigForm(forms.Form, CssClassMixin): application_pdf_title = forms.CharField( widget=forms.TextInput(), required=False, - label=_("Title for PDF document (all applications)") + label=_("Title for PDF document (all motions)") ) application_pdf_preamble = forms.CharField( widget=forms.Textarea(), required=False, - label=_("Preamble text for PDF document (all applications)") + label=_("Preamble text for PDF document (all motions)") ) application_allow_trivial_change = forms.BooleanField( label=_("Allow trivial changes"), - help_text=_('Warning: Trivial changes undermine the application ' \ - 'permission system.'), + help_text=_('Warning: Trivial changes undermine the motions ' + 'autorisation system.'), required=False, ) diff --git a/openslides/application/models.py b/openslides/application/models.py index 78ebd55b6..4c06b55a6 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -12,7 +12,6 @@ from datetime import datetime -from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.db import models from django.db.models import Max @@ -26,8 +25,6 @@ from openslides.utils.person import PersonField from openslides.config.models import config from openslides.config.signals import default_config_value -from openslides.participant.models import OpenSlidesUser - from openslides.poll.models import (BaseOption, BasePoll, CountVotesCast, CountInvalid, BaseVote) @@ -53,7 +50,7 @@ class Application(models.Model, SlideMixin): ('adj', _('Adjourned')), ('noc', _('Not Concerned')), ('com', _('Commited a bill')), - ('nop', _('Rejected (not permitted)')), + ('nop', _('Rejected (not authorized)')), ('rev', _('Needs Review')), # Where is this status used? #additional actions: # edit @@ -103,14 +100,14 @@ class Application(models.Model, SlideMixin): self.save(nonewversion=True) version.rejected = False version.save() - self.writelog(_("Version %d permitted") % (version.aid, ), + self.writelog(_("Version %d authorized") % (version.aid, ), user) def reject_version(self, version, user = None): if version.id > self.permitted.id: version.rejected = True version.save() - self.writelog(pgettext("Rejected means not permitted", "Version %d rejected") + self.writelog(pgettext("Rejected means not authorized", "Version %d rejected") % (version.aid, ), user) return True return False @@ -141,9 +138,9 @@ class Application(models.Model, SlideMixin): if self.status == "pub" and not self.enough_supporters: note.append(_("Searching for supporters.")) if self.status == "pub" and self.permitted is None: - note.append(_("Not yet permitted.")) + note.append(_("Not yet authorized.")) elif self.unpermitted_changes and self.permitted: - note.append(_("Not yet permitted changes.")) + note.append(_("Not yet authorized changes.")) return note @property @@ -309,7 +306,7 @@ class Application(models.Model, SlideMixin): self.set_number() self.permitted = aversion self.save() - self.writelog(_("Version %s permitted") % (aversion.aid), user) + self.writelog(_("Version %s authorized") % (aversion.aid), user) return self.permitted def notpermit(self, user=None): @@ -323,7 +320,7 @@ class Application(models.Model, SlideMixin): if self.number is None: self.set_number() self.save() - self.writelog(_("Version %s not permitted") % (self.last_version.aid), user) + self.writelog(_("Version %s not authorized") % (self.last_version.aid), user) def set_status(self, user, status, force=False): """ @@ -335,19 +332,22 @@ class Application(models.Model, SlideMixin): error = False break if error: + #TODO: Use the Right Error raise NameError(_('%s is not a valid status.') % status) if self.status == status: - raise NameError(_('The application status is already \'%s.\'') \ + #TODO: Use the Right Error + raise NameError(_('The motion status is already \'%s.\'') \ % self.status) actions = [] actions = self.get_allowed_actions(user) if status not in actions and not force: - raise NameError(_('The application status is: \'%(currentstatus)s\'. '\ - 'You can not set the status to \'%(newstatus)s\'.') % { - 'currentstatus': self.status, - 'newstatus': status - }) + #TODO: Use the Right Error + raise NameError(_( + 'The motion status is: \'%(currentstatus)s\'. ' + 'You can not set the status to \'%(newstatus)s\'.') % { + 'currentstatus': self.status, + 'newstatus': status}) oldstatus = self.get_status_display() self.status = status @@ -360,15 +360,6 @@ class Application(models.Model, SlideMixin): Return a list of all the allowed status. """ actions = [] - is_admin = False - if user: - try: - user = user.openslidesuser - except OpenSlidesUser.DoesNotExist: - is_admin = True - except AttributeError: - # For the anonymous-user - pass # check if user allowed to withdraw an application if ((self.status == "pub" @@ -405,11 +396,10 @@ class Application(models.Model, SlideMixin): # Check if the user can delete the application (admin, manager, owner) # reworked as requiered in #100 - if is_admin \ - or (user.has_perm("application.can_manage_application") \ - and (self.status == "pub" or self.number is None)) \ - or (self.submitter == user \ - and (self.status == "pub" or self.number is None)): + if (user.has_perm("applicatoin.can_delete_all_applications") or + (user.has_perm("application.can_manage_application") and + self.number is None) or + (self.submitter == user and self.number is None)): actions.append("delete") #For the rest, all actions need the manage permission @@ -463,7 +453,7 @@ class Application(models.Model, SlideMixin): def get_agenda_title_supplement(self): number = self.number or '[%s]' % ugettext('no number') - return '(%s %s)' % (ugettext('Application'), number) + return '(%s %s)' % (ugettext('motion'), number) def __getattr__(self, name): """ @@ -539,10 +529,10 @@ class Application(models.Model, SlideMixin): class Meta: permissions = ( - ('can_see_application', ugettext_noop("Can see application")), - ('can_create_application', ugettext_noop("Can create application")), - ('can_support_application', ugettext_noop("Can support application")), - ('can_manage_application', ugettext_noop("Can manage application")), + ('can_see_application', ugettext_noop("Can see motions")), + ('can_create_application', ugettext_noop("Can create motions")), + ('can_support_application', ugettext_noop("Can support motions")), + ('can_manage_application', ugettext_noop("Can manage motions")), ) @@ -611,7 +601,7 @@ def default_config(sender, key, **kwargs): 'application_preamble': _('The Assembly may decide,'), 'application_pdf_ballot_papers_selection': 'CUSTOM_NUMBER', 'application_pdf_ballot_papers_number': '8', - 'application_pdf_title': _('Applications'), + 'application_pdf_title': _('Motions'), 'application_pdf_preamble': '', 'application_allow_trivial_change': False, }.get(key) diff --git a/openslides/application/templates/application/base_application.html b/openslides/application/templates/application/base_application.html index 03322c352..c886215ef 100644 --- a/openslides/application/templates/application/base_application.html +++ b/openslides/application/templates/application/base_application.html @@ -6,16 +6,16 @@ {% block submenu %} {% url application_overview as url_applicationoverview %} -

{% trans "Applications" %}

+

{% trans "Motions" %}

{# second submenu #} @@ -31,18 +31,18 @@ diff --git a/openslides/application/templates/projector/Application.html b/openslides/application/templates/projector/Application.html index 4a5d1488b..8f6ff6401 100644 --- a/openslides/application/templates/projector/Application.html +++ b/openslides/application/templates/projector/Application.html @@ -4,7 +4,7 @@ {% load i18n %} {% load staticfiles %} -{% block title %}{{ block.super }} - {% trans "Application" %} {{ application.number }}{% endblock %} +{% block title %}{{ block.super }} - {% trans "Motion" %} {{ application.number }}{% endblock %} {% block content %}