Merge pull request #1510 from ostcar/rename-apps

Rename apps.
This commit is contained in:
Norman Jäckel 2015-03-29 23:15:30 +02:00
commit 1bc6aef205
114 changed files with 427 additions and 422 deletions

View File

@ -13,6 +13,11 @@ Agenda:
agenda model. No API changes. agenda model. No API changes.
Assignments: Assignments:
- Massive refactoring and cleanup of assignments app. - Massive refactoring and cleanup of assignments app.
- Renamed app from assignment to assignments
Motions:
- Renamed app from motion to motions
Mediafiles:
- Renamed app from mediafile to mediafiles
Users: Users:
- Massive refactoring of the participant app. Now called 'users'. - Massive refactoring of the participant app. Now called 'users'.
- Used new anonymous user object instead of an authentification backend. - Used new anonymous user object instead of an authentification backend.

View File

@ -8,7 +8,7 @@ class AgendaMainMenuEntry(MainMenuEntry):
Main menu entry for the agenda app. Main menu entry for the agenda app.
""" """
verbose_name = ugettext_lazy('Agenda') verbose_name = ugettext_lazy('Agenda')
required_permission = 'agenda.can_see_agenda' required_permission = 'agenda.can_see'
default_weight = 20 default_weight = 20
pattern_name = 'item_overview' pattern_name = 'item_overview'
icon_css_class = 'glyphicon-calendar' icon_css_class = 'glyphicon-calendar'

View File

@ -114,8 +114,8 @@ class Item(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, MPTTModel):
class Meta: class Meta:
permissions = ( permissions = (
('can_see_agenda', ugettext_noop("Can see agenda")), ('can_see', ugettext_noop("Can see agenda")),
('can_manage_agenda', ugettext_noop("Can manage agenda")), ('can_manage', ugettext_noop("Can manage agenda")),
('can_see_orga_items', ugettext_noop("Can see orga items and time scheduling of agenda"))) ('can_see_orga_items', ugettext_noop("Can see orga items and time scheduling of agenda")))
class MPTTMeta: class MPTTMeta:

View File

@ -2,7 +2,7 @@
{% load tags %} {% load tags %}
<div class="{% if node.is_active_slide %}activeline{% endif %}"> <div class="{% if node.is_active_slide %}activeline{% endif %}">
{% if perms.agenda.can_manage_agenda or perms.core.can_manage_projector %} {% if perms.agenda.can_manage or perms.core.can_manage_projector %}
<div class="manage"> <div class="manage">
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
{% if perms.core.can_manage_projector %} {% if perms.core.can_manage_projector %}
@ -17,7 +17,7 @@
<i class="icon icon-bell {% if node.is_active_slide and active_type == 'list_of_speakers' %}icon-white{% endif %}"></i> <i class="icon icon-bell {% if node.is_active_slide and active_type == 'list_of_speakers' %}icon-white{% endif %}"></i>
</a> </a>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<span class="optional-small"> <span class="optional-small">
<a href="{{ node|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini"> <a href="{{ node|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini">
<i class="icon-pencil"></i> <i class="icon-pencil"></i>
@ -56,7 +56,7 @@
</div> </div>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<div class="optional"> <div class="optional">
{% if node.comment %} {% if node.comment %}
{{ node.comment|first_line }} {{ node.comment|first_line }}

View File

@ -17,7 +17,7 @@
{% block content %} {% block content %}
<h1>{% trans "Agenda" %} <h1>{% trans "Agenda" %}
<small class="pull-right"> <small class="pull-right">
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<a href="{% url 'item_new' %}" class="btn btn-sm btn-primary" <a href="{% url 'item_new' %}" class="btn btn-sm btn-primary"
rel="tooltip" data-original-title="{% trans 'New item' %}"> rel="tooltip" data-original-title="{% trans 'New item' %}">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
@ -31,7 +31,7 @@
<span class="optional-small"> {% trans 'Tags' %}</span> <span class="optional-small"> {% trans 'Tags' %}</span>
</a> </a>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<a href="{% url 'item_csv_import' %}" class="btn btn-default btn-sm" <a href="{% url 'item_csv_import' %}" class="btn btn-default btn-sm"
rel="tooltip" data-original-title="{% trans 'Import agenda items' %}"> rel="tooltip" data-original-title="{% trans 'Import agenda items' %}">
<span class="glyphicon glyphicon-import" aria-hidden="true"></span> <span class="glyphicon glyphicon-import" aria-hidden="true"></span>
@ -56,7 +56,7 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="pull-left"> <div class="pull-left">
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<p> <p>
<a href="{% url 'agenda_numbering' %}" <a href="{% url 'agenda_numbering' %}"
class="btn btn-default btn-sm">{% trans 'Number agenda items' %} class="btn btn-default btn-sm">{% trans 'Number agenda items' %}
@ -95,13 +95,13 @@
<table id="menu-overview" class="table table-striped table-bordered"> <table id="menu-overview" class="table table-striped table-bordered">
<tr> <tr>
<th class="title">{% trans "Item" %}</th> <th class="title">{% trans "Item" %}</th>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<th class="optional">{% trans "Comment" %}</th> <th class="optional">{% trans "Comment" %}</th>
{% endif %} {% endif %}
{% if perms.agenda.can_see_orga_items %} {% if perms.agenda.can_see_orga_items %}
<th class="duration">{% trans "Duration" %}</th> <th class="duration">{% trans "Duration" %}</th>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda or perms.core.can_manage_projector %} {% if perms.agenda.can_manage or perms.core.can_manage_projector %}
<th class="manage">{% trans "Actions" %}</th> <th class="manage">{% trans "Actions" %}</th>
{% endif %} {% endif %}
</tr> </tr>
@ -109,13 +109,13 @@
<td class="title"> <td class="title">
{% trans "Agenda" %} {% trans "Agenda" %}
</td> </td>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<td class="optional"></td> <td class="optional"></td>
{% endif %} {% endif %}
{% if perms.agenda.can_see_orga_items %} {% if perms.agenda.can_see_orga_items %}
<td class="duration">{{ duration }} h</td> <td class="duration">{{ duration }} h</td>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda or perms.core.can_manage_projector %} {% if perms.agenda.can_manage or perms.core.can_manage_projector %}
<td class="manage"> <td class="manage">
{% if perms.core.can_manage_projector %} {% if perms.core.can_manage_projector %}
<span> <span>
@ -131,7 +131,7 @@
</tr> </tr>
</table> </table>
{% if items %} {% if items %}
<ol class="agenda_list {% if perms.agenda.can_manage_agenda %}sortable{% endif %}"> <ol class="agenda_list {% if perms.agenda.can_manage %}sortable{% endif %}">
{% recursetree items %} {% recursetree items %}
<li class="draggable"> <li class="draggable">
{% include "agenda/item_row.html" %} {% include "agenda/item_row.html" %}

View File

@ -12,7 +12,7 @@
{% block javascript %} {% block javascript %}
<script type="text/javascript" src="{% static 'js/agenda.js' %}"></script> <script type="text/javascript" src="{% static 'js/agenda.js' %}"></script>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<script type="text/javascript" src="{% static 'js/jquery/jquery-ui.custom.min.js' %}"></script> <script type="text/javascript" src="{% static 'js/jquery/jquery-ui.custom.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery/jquery.once.js' %}"></script> <script type="text/javascript" src="{% static 'js/jquery/jquery.once.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery/jquery.tmpl.js' %}"></script> <script type="text/javascript" src="{% static 'js/jquery/jquery.tmpl.js' %}"></script>
@ -22,7 +22,7 @@
{% block content %} {% block content %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<div id="changed-order-message" style="display:none" class="alert alert-warning"> <div id="changed-order-message" style="display:none" class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">×</button> <button type="button" class="close" data-dismiss="alert">×</button>
{% trans "Do you want to save the changed order of agenda items?" %}<br> {% trans "Do you want to save the changed order of agenda items?" %}<br>
@ -33,7 +33,7 @@
<h1>{% trans "Agenda" %} <h1>{% trans "Agenda" %}
<small class="pull-right"> <small class="pull-right">
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<a href="{% url 'item_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New item' %}"> <a href="{% url 'item_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New item' %}">
<i class="icon-plus icon-white"></i> <i class="icon-plus icon-white"></i>
{% trans "New" %} {% trans "New" %}
@ -45,7 +45,7 @@
<span class="optional-small"> {% trans 'Tags' %}</span> <span class="optional-small"> {% trans 'Tags' %}</span>
</a> </a>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<a href="{% url 'item_csv_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import agenda items' %}"> <a href="{% url 'item_csv_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import agenda items' %}">
<i class="icon-import"></i> <i class="icon-import"></i>
{% trans "Import" %} {% trans "Import" %}
@ -61,7 +61,7 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="pull-left"> <div class="pull-left">
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<p><a href="{% url 'agenda_numbering' %}" <p><a href="{% url 'agenda_numbering' %}"
class="btn btn-mini">{% trans 'Number agenda items' %}</a> class="btn btn-mini">{% trans 'Number agenda items' %}</a>
</p> </p>
@ -96,13 +96,13 @@
<table id="menu-overview" class="table table-striped table-bordered"> <table id="menu-overview" class="table table-striped table-bordered">
<tr> <tr>
<th class="title">{% trans "Item" %}</th> <th class="title">{% trans "Item" %}</th>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<th class="optional">{% trans "Comment" %}</th> <th class="optional">{% trans "Comment" %}</th>
{% endif %} {% endif %}
{% if perms.agenda.can_see_orga_items %} {% if perms.agenda.can_see_orga_items %}
<th class="duration">{% trans "Duration" %}</th> <th class="duration">{% trans "Duration" %}</th>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda or perms.core.can_manage_projector %} {% if perms.agenda.can_manage or perms.core.can_manage_projector %}
<th class="manage">{% trans "Actions" %}</th> <th class="manage">{% trans "Actions" %}</th>
{% endif %} {% endif %}
</tr> </tr>
@ -110,13 +110,13 @@
<td class="title"> <td class="title">
{% trans "Agenda" %} {% trans "Agenda" %}
</td> </td>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<td class="optional"></td> <td class="optional"></td>
{% endif %} {% endif %}
{% if perms.agenda.can_see_orga_items %} {% if perms.agenda.can_see_orga_items %}
<td class="duration">{{ duration }} h</td> <td class="duration">{{ duration }} h</td>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda or perms.core.can_manage_projector %} {% if perms.agenda.can_manage or perms.core.can_manage_projector %}
<td class="manage"> <td class="manage">
{% if perms.core.can_manage_projector %} {% if perms.core.can_manage_projector %}
<span> <span>
@ -132,7 +132,7 @@
</tr> </tr>
</table> </table>
{% if items %} {% if items %}
<ol class="agenda_list {% if perms.agenda.can_manage_agenda %}sortable{% endif %}"> <ol class="agenda_list {% if perms.agenda.can_manage %}sortable{% endif %}">
{% recursetree items %} {% recursetree items %}
<li class="draggable"> <li class="draggable">
{% include "agenda/item_row.html" %} {% include "agenda/item_row.html" %}

View File

@ -27,7 +27,7 @@
<i class="icon icon-facetime-video {% if item.is_active_slide and active_type != 'list_of_speakers' %}icon-white{% endif %}"></i> <i class="icon icon-facetime-video {% if item.is_active_slide and active_type != 'list_of_speakers' %}icon-white{% endif %}"></i>
</a> </a>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<div class="btn-group"> <div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle"> <a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} {% trans 'More actions' %}
@ -57,7 +57,7 @@
</p> </p>
<!-- Comment --> <!-- Comment -->
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
{% if item.comment %} {% if item.comment %}
<h3>{% trans "Comment" %}</h3> <h3>{% trans "Comment" %}</h3>
<p>{{ item.comment|linebreaks }}</p> <p>{{ item.comment|linebreaks }}</p>
@ -67,7 +67,7 @@
<!-- List of Speakers --> <!-- List of Speakers -->
<h3>{% trans "List of speakers" %} {% if item.speaker_list_closed %}<span class="label label-important">{% trans 'closed' %}</span>{% endif %}</h3> <h3>{% trans "List of speakers" %} {% if item.speaker_list_closed %}<span class="label label-important">{% trans 'closed' %}</span>{% endif %}</h3>
<p> <p>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
{% if item.speaker_list_closed %} {% if item.speaker_list_closed %}
<a href="{% url 'agenda_speaker_reopen' item.pk %}" class="btn btn-mini btn-danger">{% trans 'Open list' %}</a> <a href="{% url 'agenda_speaker_reopen' item.pk %}" class="btn btn-mini btn-danger">{% trans 'Open list' %}</a>
{% else %} {% else %}
@ -84,7 +84,7 @@
{% endif %} {% endif %}
</p> </p>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<form id="coming_speakers_changed_form" action="{% url 'agenda_speaker_change_order' item.pk %}" method="post" style="display:none" class="alert alert-warning">{% csrf_token %} <form id="coming_speakers_changed_form" action="{% url 'agenda_speaker_change_order' item.pk %}" method="post" style="display:none" class="alert alert-warning">{% csrf_token %}
<button type="button" class="close" data-dismiss="alert">×</button> <button type="button" class="close" data-dismiss="alert">×</button>
{% trans "Do you want to save the changed order of speakers?" %}<br> {% trans "Do you want to save the changed order of speakers?" %}<br>
@ -119,13 +119,13 @@
{% endif %} {% endif %}
<li id="speaker_{{ speaker_dict.speaker.pk }}"> <li id="speaker_{{ speaker_dict.speaker.pk }}">
{% if speaker_dict.type == 'coming_speaker' %} {% if speaker_dict.type == 'coming_speaker' %}
<span {% if perms.agenda.can_manage_agenda %}class="ui-icon ui-icon-arrowthick-2-n-s"{% endif %}></span> <span {% if perms.agenda.can_manage %}class="ui-icon ui-icon-arrowthick-2-n-s"{% endif %}></span>
{{ speaker_dict.prefix }}. {{ speaker_dict.prefix }}.
{% else %} {% else %}
<small class="grey">[{{ speaker_dict.speaker.begin_time }}{% if speaker_dict.type == 'old_speaker' %} {{ speaker_dict.speaker.end_time }}{% endif %}]</small> <small class="grey">[{{ speaker_dict.speaker.begin_time }}{% if speaker_dict.type == 'old_speaker' %} {{ speaker_dict.speaker.end_time }}{% endif %}]</small>
{% endif %} {% endif %}
<a href="{{ speaker_dict.speaker|absolute_url }}">{{ speaker_dict.speaker }}</a> <a href="{{ speaker_dict.speaker|absolute_url }}">{{ speaker_dict.speaker }}</a>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
{% if speaker_dict.type == 'actual_speaker' %} {% if speaker_dict.type == 'actual_speaker' %}
<a href="{% url 'agenda_speaker_end_speach' item.pk %}" class="btn btn-mini btn-danger"><i class="icon-bell icon-white"></i> {% trans 'End speach' %}</a> <a href="{% url 'agenda_speaker_end_speach' item.pk %}" class="btn btn-mini btn-danger"><i class="icon-bell icon-white"></i> {% trans 'End speach' %}</a>
{% elif speaker_dict.type == 'coming_speaker' %} {% elif speaker_dict.type == 'coming_speaker' %}
@ -151,7 +151,7 @@
{% endif %} {% endif %}
</p> </p>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{% for field in form %} {% for field in form %}
<label>{{ field.label }}:</label> <label>{{ field.label }}:</label>

View File

@ -27,7 +27,7 @@
rel="tooltip" data-original-title="{% trans 'Show' %}"> rel="tooltip" data-original-title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if item.is_active_slide and active_type == 'text' %}icon-white{% endif %}"></i> <i class="icon-facetime-video {% if item.is_active_slide and active_type == 'text' %}icon-white{% endif %}"></i>
</a>&nbsp; </a>&nbsp;
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<a href="{{ item|absolute_url:'update' }}" <a href="{{ item|absolute_url:'update' }}"
rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right"> rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i> <i class="icon-pencil"></i>

View File

@ -6,7 +6,7 @@
{% if perms.agenda.can_be_speaker %} {% if perms.agenda.can_be_speaker %}
<p><a href="{% url 'agenda_add_to_current_list_of_speakers' %}" class="btn"><i class="icon icon-speaker"></i> {% trans 'Put me on the current list of speakers' %}</a></p> <p><a href="{% url 'agenda_add_to_current_list_of_speakers' %}" class="btn"><i class="icon icon-speaker"></i> {% trans 'Put me on the current list of speakers' %}</a></p>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<p> <p>
<a href="{% url 'agenda_next_on_current_list_of_speakers' %}" class="btn btn-mini"><i class="icon icon-bell"></i> {% trans 'Next speaker' %}</a> <a href="{% url 'agenda_next_on_current_list_of_speakers' %}" class="btn btn-mini"><i class="icon icon-bell"></i> {% trans 'Next speaker' %}</a>
<a href="{% url 'agenda_end_speach_on_current_list_of_speakers' %}" class="btn btn-mini"><i class="icon icon-bell"></i> {% trans 'End speach' %}</a> <a href="{% url 'agenda_end_speach_on_current_list_of_speakers' %}" class="btn btn-mini"><i class="icon icon-bell"></i> {% trans 'End speach' %}</a>

View File

@ -1,7 +1,7 @@
{% load i18n %} {% load i18n %}
{% load highlight %} {% load highlight %}
{% if perms.agenda.can_see_agenda and result.object.type == result.object.AGENDA_ITEM %} {% if perms.agenda.can_see and result.object.type == result.object.AGENDA_ITEM %}
<li> <li>
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br> <a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
<span class="app">{% trans "Agenda" %}</a></span><br> <span class="app">{% trans "Agenda" %}</a></span><br>

View File

@ -50,7 +50,7 @@ class Overview(TemplateView):
""" """
Show all agenda items, and update their range via post. Show all agenda items, and update their range via post.
""" """
required_permission = 'agenda.can_see_agenda' required_permission = 'agenda.can_see'
template_name = 'agenda/overview.html' template_name = 'agenda/overview.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
@ -120,7 +120,7 @@ class Overview(TemplateView):
return context return context
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
if not request.user.has_perm('agenda.can_manage_agenda'): if not request.user.has_perm('agenda.can_manage'):
messages.error( messages.error(
request, request,
_('You are not authorized to manage the agenda.')) _('You are not authorized to manage the agenda.'))
@ -179,7 +179,7 @@ class AgendaItemView(SingleObjectMixin, FormView):
if self.get_object().type == Item.ORGANIZATIONAL_ITEM: if self.get_object().type == Item.ORGANIZATIONAL_ITEM:
check_permission = request.user.has_perm('agenda.can_see_orga_items') check_permission = request.user.has_perm('agenda.can_see_orga_items')
else: else:
check_permission = request.user.has_perm('agenda.can_see_agenda') check_permission = request.user.has_perm('agenda.can_see')
return check_permission return check_permission
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
@ -209,7 +209,7 @@ class SetClosed(SingleObjectMixin, RedirectView):
""" """
Close or open an item. Close or open an item.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
allow_ajax = True allow_ajax = True
url_name = 'item_overview' url_name = 'item_overview'
model = Item model = Item
@ -237,7 +237,7 @@ class ItemUpdate(UpdateView):
""" """
Update an existing item. Update an existing item.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
template_name = 'agenda/edit.html' template_name = 'agenda/edit.html'
model = Item model = Item
context_object_name = 'item' context_object_name = 'item'
@ -256,7 +256,7 @@ class ItemCreate(CreateView):
""" """
Create a new item. Create a new item.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
template_name = 'agenda/edit.html' template_name = 'agenda/edit.html'
model = Item model = Item
context_object_name = 'item' context_object_name = 'item'
@ -269,7 +269,7 @@ class ItemDelete(DeleteView):
""" """
Delete an item. Delete an item.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
model = Item model = Item
question_url_name = 'item_overview' question_url_name = 'item_overview'
success_url_name = 'item_overview' success_url_name = 'item_overview'
@ -325,7 +325,7 @@ class CreateRelatedAgendaItemView(SingleObjectMixin, RedirectView):
This view is only for subclassing in views of related apps. You This view is only for subclassing in views of related apps. You
have to define 'model = ....' have to define 'model = ....'
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
url_name = 'item_overview' url_name = 'item_overview'
url_name_args = [] url_name_args = []
@ -337,7 +337,7 @@ class CreateRelatedAgendaItemView(SingleObjectMixin, RedirectView):
class AgendaNumberingView(QuestionView): class AgendaNumberingView(QuestionView):
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
question_url_name = 'item_overview' question_url_name = 'item_overview'
url_name = 'item_overview' url_name = 'item_overview'
question_message = ugettext_lazy('Do you really want to generate agenda numbering? Manually added item numbers will be overwritten!') question_message = ugettext_lazy('Do you really want to generate agenda numbering? Manually added item numbers will be overwritten!')
@ -356,7 +356,7 @@ class AgendaPDF(PDFView):
""" """
Create a full agenda-PDF. Create a full agenda-PDF.
""" """
required_permission = 'agenda.can_see_agenda' required_permission = 'agenda.can_see'
filename = ugettext_lazy('Agenda') filename = ugettext_lazy('Agenda')
document_title = ugettext_lazy('Agenda') document_title = ugettext_lazy('Agenda')
@ -404,7 +404,7 @@ class SpeakerDeleteView(DeleteView):
Check the permission to delete a speaker. Check the permission to delete a speaker.
""" """
if 'speaker' in kwargs: if 'speaker' in kwargs:
return request.user.has_perm('agenda.can_manage_agenda') return request.user.has_perm('agenda.can_manage')
else: else:
# Any user who is on the list of speakers can delete himself from the list. # Any user who is on the list of speakers can delete himself from the list.
return True return True
@ -454,7 +454,7 @@ class SpeakerSpeakView(SingleObjectMixin, RedirectView):
""" """
Mark the speaking user. Mark the speaking user.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
url_name = 'item_view' url_name = 'item_view'
model = Item model = Item
@ -480,7 +480,7 @@ class SpeakerEndSpeachView(SingleObjectMixin, RedirectView):
""" """
The speach of the actual speaker is finished. The speach of the actual speaker is finished.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
url_name = 'item_view' url_name = 'item_view'
model = Item model = Item
@ -505,7 +505,7 @@ class SpeakerListCloseView(SingleObjectMixin, RedirectView):
""" """
View to close and reopen a list of speakers. View to close and reopen a list of speakers.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
model = Item model = Item
reopen = False reopen = False
url_name = 'item_view' url_name = 'item_view'
@ -524,7 +524,7 @@ class SpeakerChangeOrderView(SingleObjectMixin, RedirectView):
Has to be called as post-request with the new order of the speaker ids. Has to be called as post-request with the new order of the speaker ids.
""" """
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
model = Item model = Item
url_name = 'item_view' url_name = 'item_view'
@ -657,7 +657,7 @@ class CurrentListOfSpeakersView(RedirectView):
else: else:
return reverse('item_view', args=[item.pk]) return reverse('item_view', args=[item.pk])
else: else:
if reverse_to_dashboard or not self.request.user.has_perm('agenda.can_see_agenda'): if reverse_to_dashboard or not self.request.user.has_perm('agenda.can_see'):
return reverse('core_dashboard') return reverse('core_dashboard')
else: else:
return reverse('item_view', args=[item.pk]) return reverse('item_view', args=[item.pk])
@ -770,7 +770,7 @@ class ItemCSVImportView(CSVImportView):
Imports agenda items from an uploaded csv file. Imports agenda items from an uploaded csv file.
""" """
import_function = staticmethod(import_agenda_items) import_function = staticmethod(import_agenda_items)
required_permission = 'agenda.can_manage_agenda' required_permission = 'agenda.can_manage'
success_url_name = 'item_overview' success_url_name = 'item_overview'
template_name = 'agenda/item_form_csv_import.html' template_name = 'agenda/item_form_csv_import.html'
@ -789,9 +789,9 @@ class ItemViewSet(ModelViewSet):
requests the permission to manage the agenda and to see organizational requests the permission to manage the agenda and to see organizational
items. items.
""" """
if (not request.user.has_perm('agenda.can_see_agenda') or if (not request.user.has_perm('agenda.can_see') or
(self.action in ('create', 'update', 'destroy') and not (self.action in ('create', 'update', 'destroy') and not
(request.user.has_perm('agenda.can_manage_agenda') and (request.user.has_perm('agenda.can_manage') and
request.user.has_perm('agenda.can_see_orga_items')))): request.user.has_perm('agenda.can_see_orga_items')))):
self.permission_denied(request) self.permission_denied(request)

View File

@ -46,5 +46,5 @@ class ListOfSpeakersWidget(Widget):
icon_css_class = 'icon-bell' icon_css_class = 'icon-bell'
def check_permission(self): def check_permission(self):
return (self.request.user.has_perm('agenda.can_manage_agenda') or return (self.request.user.has_perm('agenda.can_manage') or
self.request.user.has_perm('agenda.can_be_speaker')) self.request.user.has_perm('agenda.can_be_speaker'))

View File

@ -1 +0,0 @@
default_app_config = 'openslides.assignment.apps.AssignmentAppConfig'

View File

@ -0,0 +1 @@
default_app_config = 'openslides.assignments.apps.AssignmentAppConfig'

View File

@ -2,8 +2,8 @@ from django.apps import AppConfig
class AssignmentAppConfig(AppConfig): class AssignmentAppConfig(AppConfig):
name = 'openslides.assignment' name = 'openslides.assignments'
verbose_name = 'OpenSlides Assignment' verbose_name = 'OpenSlides Assignments'
def ready(self): def ready(self):
# Load main menu entry, personal info and widgets. # Load main menu entry, personal info and widgets.
@ -28,8 +28,8 @@ class AssignmentAppConfig(AppConfig):
# Register slides. # Register slides.
Assignment = self.get_model('Assignment') Assignment = self.get_model('Assignment')
AssignmentPoll = self.get_model('AssignmentPoll') AssignmentPoll = self.get_model('AssignmentPoll')
register_slide_model(Assignment, 'assignment/slide.html') register_slide_model(Assignment, 'assignments/slide.html')
register_slide_model(AssignmentPoll, 'assignment/assignmentpoll_slide.html') register_slide_model(AssignmentPoll, 'assignments/assignmentpoll_slide.html')
# Register viewsets. # Register viewsets.
router.register('assignment/assignment', AssignmentViewSet) router.register('assignments/assignment', AssignmentViewSet)

View File

@ -8,7 +8,7 @@ class AssignmentMainMenuEntry(MainMenuEntry):
Main menu entry for the assignment app. Main menu entry for the assignment app.
""" """
verbose_name = ugettext_lazy('Elections') verbose_name = ugettext_lazy('Elections')
required_permission = 'assignment.can_see_assignments' required_permission = 'assignments.can_see'
default_weight = 40 default_weight = 40
pattern_name = 'assignment_list' pattern_name = 'assignment_list'
icon_css_class = 'icon-assignment' icon_css_class = 'icon-assignment'

View File

@ -122,10 +122,10 @@ class Assignment(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
('can_see_assignments', ugettext_noop('Can see elections')), ('can_see', ugettext_noop('Can see elections')),
('can_nominate_other', ugettext_noop('Can nominate another participant')), ('can_nominate_other', ugettext_noop('Can nominate another participant')),
('can_nominate_self', ugettext_noop('Can nominate oneself')), ('can_nominate_self', ugettext_noop('Can nominate oneself')),
('can_manage_assignments', ugettext_noop('Can manage elections')), ('can_manage', ugettext_noop('Can manage elections')),
) )
ordering = ('title', ) ordering = ('title', )
verbose_name = ugettext_noop('Election') verbose_name = ugettext_noop('Election')

View File

@ -5,7 +5,7 @@ from .models import Assignment
class Index(indexes.SearchIndex, indexes.Indexable): class Index(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True) text = indexes.EdgeNgramField(document=True, use_template=True)
modelfilter_name = "Elections" # verbose_name of model modelfilter_name = "Elections" # verbose_name of model
modelfilter_value = "assignment.assignment" # 'app_name.model_name' modelfilter_value = "assignments.assignment" # 'app_name.model_name'
def get_model(self): def get_model(self):
return Assignment return Assignment

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -36,8 +36,8 @@ angular.module('OpenSlidesApp.assignments', [])
.factory('Assignment', function(DS) { .factory('Assignment', function(DS) {
return DS.defineResource({ return DS.defineResource({
name: 'assignment/assignment', name: 'assignments/assignment',
endpoint: '/rest/assignment/assignment/' endpoint: '/rest/assignments/assignment/'
}); });
}) })

View File

@ -35,13 +35,13 @@
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> <span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
</a> </a>
{% endif %} {% endif %}
{% if perms.assignment.can_manage_assignments or perms.agenda.can_manage_agenda %} {% if perms.assignments.can_manage or perms.agenda.can_manage %}
<div class="btn-group"> <div class="btn-group">
<a data-toggle="dropdown" class="btn btn-default btn-sm dropdown-toggle"> <a data-toggle="dropdown" class="btn btn-default btn-sm dropdown-toggle">
<span class="optional-small">{% trans 'More actions' %}</span> <span class="caret"></span> <span class="optional-small">{% trans 'More actions' %}</span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<!-- edit --> <!-- edit -->
<li> <li>
<a href="{{ assignment|absolute_url:'update' }}"> <a href="{{ assignment|absolute_url:'update' }}">
@ -58,7 +58,7 @@
</li> </li>
{% endif %} {% endif %}
<!-- create agenda item --> <!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<li> <li>
<a href="{% url 'assignment_create_agenda' assignment.id %}"> <a href="{% url 'assignment_create_agenda' assignment.id %}">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
@ -94,7 +94,7 @@
{% for person in assignment.candidates %} {% for person in assignment.candidates %}
<li> <li>
<a href="{{ person|absolute_url }}">{{ person }}</a> <a href="{{ person|absolute_url }}">{{ person }}</a>
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a href="{% url 'assignment_del_candidate_other' assignment.id person.pk %}" <a href="{% url 'assignment_del_candidate_other' assignment.id person.pk %}"
class="btn btn-default btn-xs" class="btn btn-default btn-xs"
rel="tooltip" data-original-title="{% trans 'Remove candidate' %}"> rel="tooltip" data-original-title="{% trans 'Remove candidate' %}">
@ -103,7 +103,7 @@
{% endif %} {% endif %}
{% if person in assignment.elected %} {% if person in assignment.elected %}
| <b>{% trans "elected" %}</b> | <b>{% trans "elected" %}</b>
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a href="{% url 'assignment_user_not_elected' assignment.id person.pk %}" <a href="{% url 'assignment_user_not_elected' assignment.id person.pk %}"
class="btn btn-default btn-xs" class="btn btn-default btn-xs"
rel="tooltip" data-original-title="{% trans 'Mark candidate as not elected' %}"> rel="tooltip" data-original-title="{% trans 'Mark candidate as not elected' %}">
@ -118,10 +118,10 @@
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>
{% if assignment.phase == assignment.PHASE_SEARCH or perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %} {% if assignment.phase == assignment.PHASE_SEARCH or perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
{% if perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %} {% if perms.assignments.can_nominate_self or perms.assignments.can_nominate_other %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{% if perms.assignment.can_nominate_self %} {% if perms.assignments.can_nominate_self %}
<p> <p>
{% if user_is_candidate %} {% if user_is_candidate %}
<a href='{% url 'assignment_del_candidate' assignment.id %}' class="btn btn-default btn-sm"> <a href='{% url 'assignment_del_candidate' assignment.id %}' class="btn btn-default btn-sm">
@ -136,7 +136,7 @@
{% endif %} {% endif %}
</p> </p>
{% endif %} {% endif %}
{% if perms.assignment.can_nominate_other %} {% if perms.assignments.can_nominate_other %}
{% for field in form %} {% for field in form %}
<label>{{ field.label }}:</label> <label>{{ field.label }}:</label>
{{ field }} {{ field }}
@ -157,7 +157,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if perms.assignment.can_manage_assignments and blocked_candidates and assignment.phase != assignment.PHASE_FINISHED %} {% if perms.assignments.can_manage and blocked_candidates and assignment.phase != assignment.PHASE_FINISHED %}
<h4>{% trans "Blocked Candidates" %}</h4> <h4>{% trans "Blocked Candidates" %}</h4>
<ul> <ul>
{% for person in blocked_candidates %} {% for person in blocked_candidates %}
@ -184,9 +184,9 @@
<th>{% trans "Candidates" %}</th> <th>{% trans "Candidates" %}</th>
{% for poll in polls %} {% for poll in polls %}
<th style="white-space: nowrap;" class="col-sm-1"> <th style="white-space: nowrap;" class="col-sm-1">
{% if perms.assignment.can_manage_assignments %}<p class="text-center">{% endif %} {% if perms.assignments.can_manage %}<p class="text-center">{% endif %}
{{ poll.get_ballot|ordinal|safe }} {% trans 'ballot' %} {{ poll.get_ballot|ordinal|safe }} {% trans 'ballot' %}
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a class="publish_link btn btn-sm btn-danger {% if poll.published %}btn-primary{% endif %}" <a class="publish_link btn btn-sm btn-danger {% if poll.published %}btn-primary{% endif %}"
href="{% url 'assignmentpoll_publish_poll' poll.id %}" href="{% url 'assignmentpoll_publish_poll' poll.id %}"
rel="tooltip" data-original-title="{% trans 'Publish result' %}"> rel="tooltip" data-original-title="{% trans 'Publish result' %}">
@ -213,7 +213,7 @@
{% endif %} {% endif %}
</th> </th>
{% endfor %} {% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %} {% if assignment.candidates and perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
<th class="col-sm-1 nobr"> <th class="col-sm-1 nobr">
<a href="{% url 'assignmentpoll_create' assignment.pk %}" class="btn btn-default btn-sm"> <a href="{% url 'assignmentpoll_create' assignment.pk %}" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
@ -226,7 +226,7 @@
<tr> <tr>
<td> <td>
{% if candidate in assignment.elected %} {% if candidate in assignment.elected %}
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a class="election_link elected tooltip-bottom" href="{% url 'assignment_user_not_elected' assignment.id candidate.pk %}" <a class="election_link elected tooltip-bottom" href="{% url 'assignment_user_not_elected' assignment.id candidate.pk %}"
data-original-title="{% trans 'Mark candidate as elected' %}"></a> data-original-title="{% trans 'Mark candidate as elected' %}"></a>
{% else %} {% else %}
@ -235,7 +235,7 @@
</a> </a>
{% endif %} {% endif %}
{% else %} {% else %}
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a class="election_link tooltip-bottom" href="{% url 'assignment_user_elected' assignment.id candidate.pk %}" <a class="election_link tooltip-bottom" href="{% url 'assignment_user_elected' assignment.id candidate.pk %}"
data-original-title="{% trans 'Mark candidate as elected' %}"></a> data-original-title="{% trans 'Mark candidate as elected' %}"></a>
{% endif %} {% endif %}
@ -257,7 +257,7 @@
{% endif %} {% endif %}
</td> </td>
{% endfor %} {% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %} {% if assignment.candidates and perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
<td></td> <td></td>
{% endif %} {% endif %}
</tr> </tr>
@ -265,7 +265,7 @@
<tr> <tr>
<td>{% trans 'Valid votes' %}</td> <td>{% trans 'Valid votes' %}</td>
{% for poll in polls %} {% for poll in polls %}
{% if poll.published or perms.assignment.can_manage_assignments %} {% if poll.published or perms.assignments.can_manage %}
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">
{% if poll.has_votes %} {% if poll.has_votes %}
<img src="{% static 'img/voting-yes-grey.png' %}" class="tooltip-left" data-original-title="{% trans 'Valid votes' %}"> <img src="{% static 'img/voting-yes-grey.png' %}" class="tooltip-left" data-original-title="{% trans 'Valid votes' %}">
@ -274,14 +274,14 @@
</td> </td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %} {% if assignment.candidates and perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
<td></td> <td></td>
{% endif %} {% endif %}
</tr> </tr>
<tr> <tr>
<td>{% trans 'Invalid votes' %}</td> <td>{% trans 'Invalid votes' %}</td>
{% for poll in polls %} {% for poll in polls %}
{% if poll.published or perms.assignment.can_manage_assignments %} {% if poll.published or perms.assignments.can_manage %}
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">
{% if poll.has_votes %} {% if poll.has_votes %}
<img src="{% static 'img/voting-invalid.png' %}" class="tooltip-left" data-original-title="{% trans 'Invalid votes' %}"> <img src="{% static 'img/voting-invalid.png' %}" class="tooltip-left" data-original-title="{% trans 'Invalid votes' %}">
@ -290,14 +290,14 @@
</td> </td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %} {% if assignment.candidates and perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
<td></td> <td></td>
{% endif %} {% endif %}
</tr> </tr>
<tr class="info total"> <tr class="info total">
<td>{% trans 'Votes cast' %}</td> <td>{% trans 'Votes cast' %}</td>
{% for poll in polls %} {% for poll in polls %}
{% if poll.published or perms.assignment.can_manage_assignments %} {% if poll.published or perms.assignments.can_manage %}
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">
{% if poll.has_votes %} {% if poll.has_votes %}
<img src="{% static 'img/voting-total.png' %}" class="tooltip-left" data-original-title="{% trans 'Votes cast' %}"> <img src="{% static 'img/voting-total.png' %}" class="tooltip-left" data-original-title="{% trans 'Votes cast' %}">
@ -306,14 +306,14 @@
</td> </td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %} {% if assignment.candidates and perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
<td></td> <td></td>
{% endif %} {% endif %}
</tr> </tr>
</table> </table>
{% else %} {% else %}
<i>{% trans "No ballots available." %}</i> <i>{% trans "No ballots available." %}</i>
{% if assignment.candidates and perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %} {% if assignment.candidates and perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
<p> <p>
<a href='{% url 'assignmentpoll_create' assignment.id %}' class="btn btn-default"> <a href='{% url 'assignmentpoll_create' assignment.id %}' class="btn btn-default">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
@ -335,7 +335,7 @@
{{ assignment.posts }} {{ assignment.posts }}
</div> <!--/well--> </div> <!--/well-->
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<div class="well"> <div class="well">
<h4>{% trans "Change phase" %}:</h4> <h4>{% trans "Change phase" %}:</h4>
<div class="btn-group btn-group-vertical" data-toggle="buttons-radio"> <div class="btn-group btn-group-vertical" data-toggle="buttons-radio">

View File

@ -9,7 +9,7 @@
{% block content %} {% block content %}
<h1>{% trans "Elections" %} <h1>{% trans "Elections" %}
<small class="pull-right"> <small class="pull-right">
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a href="{% url 'assignment_create' %}" class="btn btn-primary btn-sm" <a href="{% url 'assignment_create' %}" class="btn btn-primary btn-sm"
rel="tooltip" data-original-title="{% trans 'New election' %}"> rel="tooltip" data-original-title="{% trans 'New election' %}">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
@ -23,7 +23,7 @@
<span class="optional-small"> {% trans 'Tags' %}</span> <span class="optional-small"> {% trans 'Tags' %}</span>
</a> </a>
{% endif %} {% endif %}
{% if perms.assignment.can_see_assignments %} {% if perms.assignments.can_see %}
<a href="{% url 'assignment_list_pdf' %}" class="btn btn-default btn-sm" <a href="{% url 'assignment_list_pdf' %}" class="btn btn-default btn-sm"
rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}" target="_blank"> rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}" target="_blank">
<span class="glyphicon glyphicon-print" aria-hidden="true"></span> <span class="glyphicon glyphicon-print" aria-hidden="true"></span>
@ -39,7 +39,7 @@
<th>{% trans "Election" %}</th> <th>{% trans "Election" %}</th>
<th class="optional">{% trans "Candidates" %}</th> <th class="optional">{% trans "Candidates" %}</th>
<th>{% trans "Phase" %}</th> <th>{% trans "Phase" %}</th>
{% if perms.assignment.can_manage_assignments or perms.core.can_manage_projector %} {% if perms.assignments.can_manage or perms.core.can_manage_projector %}
<th class="mini_width">{% trans "Actions" %}</th> <th class="mini_width">{% trans "Actions" %}</th>
{% endif %} {% endif %}
</tr> </tr>
@ -63,7 +63,7 @@
| {% trans "Elected" %}: <span class="badge badge-success">{{ object.elected.count }}</span> | {% trans "Elected" %}: <span class="badge badge-success">{{ object.elected.count }}</span>
</td> </td>
<td><span class="label label-info">{{ object.get_phase_display }}</span></td> <td><span class="label label-info">{{ object.get_phase_display }}</span></td>
{% if perms.assignment.can_manage_assignments or perms.core.can_manage_projector %} {% if perms.assignments.can_manage or perms.core.can_manage_projector %}
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
{% if perms.core.can_manage_projector %} {% if perms.core.can_manage_projector %}
@ -73,7 +73,7 @@
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> <span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
</a> </a>
{% endif %} {% endif %}
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a href="{{ object|absolute_url:'update' }}" <a href="{{ object|absolute_url:'update' }}"
rel="tooltip" data-original-title="{% trans 'Edit' %}" rel="tooltip" data-original-title="{% trans 'Edit' %}"
class="btn btn-default btn-sm"> class="btn btn-default btn-sm">

View File

@ -25,7 +25,7 @@
rel="tooltip" data-original-title="{% trans 'Show election result' %}"> rel="tooltip" data-original-title="{% trans 'Show election result' %}">
<i class="icon-facetime-video {% if poll.is_active_slide %}icon-white{% endif %}"></i> {% trans "Election result" %}</a> <i class="icon-facetime-video {% if poll.is_active_slide %}icon-white{% endif %}"></i> {% trans "Election result" %}</a>
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<a class="btn btn-mini" href="{{ poll|absolute_url:'delete' }}" <a class="btn btn-mini" href="{{ poll|absolute_url:'delete' }}"
rel="tooltip" data-original-title="{% trans 'Delete ballot' %}"><i class="icon-remove"></i></a> rel="tooltip" data-original-title="{% trans 'Delete ballot' %}"><i class="icon-remove"></i></a>
{% endif %} {% endif %}

View File

@ -11,7 +11,7 @@
rel="tooltip" data-original-title="{% trans 'Show' %}"> rel="tooltip" data-original-title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if assignment.is_active_slide %}icon-white{% endif %}"></i> <i class="icon-facetime-video {% if assignment.is_active_slide %}icon-white{% endif %}"></i>
</a>&nbsp; </a>&nbsp;
{% if perms.assignment.can_manage_assignments %} {% if perms.assignments.can_manage %}
<a href="{{ assignment|absolute_url:'update' }}" <a href="{{ assignment|absolute_url:'update' }}"
rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right"> rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i> <i class="icon-pencil"></i>

View File

@ -1,7 +1,7 @@
{% load i18n %} {% load i18n %}
{% load highlight %} {% load highlight %}
{% if perms.assignment.can_see_assignments %} {% if perms.assignments.can_see %}
<li> <li>
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br> <a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
<span class="app">{% trans "Election" %}</a></span><br> <span class="app">{% trans "Election" %}</a></span><br>

View File

@ -30,7 +30,7 @@ class AssignmentListView(ListView):
""" """
Lists all assignments. Lists all assignments.
""" """
required_permission = 'assignment.can_see_assignments' required_permission = 'assignments.can_see'
model = Assignment model = Assignment
@ -39,7 +39,7 @@ class AssignmentDetail(DetailView):
Shows one assignment. Shows one assignment.
""" """
# TODO: use another view as 'run form' when updating this to angular # TODO: use another view as 'run form' when updating this to angular
required_permission = 'assignment.can_see_assignments' required_permission = 'assignments.can_see'
model = Assignment model = Assignment
form_class = AssignmentRunForm form_class = AssignmentRunForm
@ -52,7 +52,7 @@ class AssignmentDetail(DetailView):
context['form'] = self.form_class() context['form'] = self.form_class()
polls = assignment.polls.all() polls = assignment.polls.all()
if not self.request.user.has_perm('assignment.can_manage_assignments'): if not self.request.user.has_perm('assignments.can_manage'):
polls = polls.filter(published=True) polls = polls.filter(published=True)
vote_results = assignment.vote_results(only_published=True) vote_results = assignment.vote_results(only_published=True)
else: else:
@ -66,15 +66,15 @@ class AssignmentDetail(DetailView):
return context return context
def post(self, *args, **kwargs): def post(self, *args, **kwargs):
if self.request.user.has_perm('assignment.can_nominate_other'): if self.request.user.has_perm('assignments.can_nominate_other'):
assignment = self.get_object() assignment = self.get_object()
form = self.form_class(self.request.POST) form = self.form_class(self.request.POST)
if form.is_valid(): if form.is_valid():
user = form.cleaned_data['candidate'] user = form.cleaned_data['candidate']
if (assignment.phase == assignment.PHASE_SEARCH or if (assignment.phase == assignment.PHASE_SEARCH or
self.request.user.has_perm('assignment.can_manage_assignments')): self.request.user.has_perm('assignments.can_manage')):
if (assignment.is_blocked(user) and if (assignment.is_blocked(user) and
not self.request.user.has_perm('assignment.can_manage_assignments')): not self.request.user.has_perm('assignments.can_manage')):
messages.error( messages.error(
self.request, self.request,
_("User %s does not want to be an candidate") % user) _("User %s does not want to be an candidate") % user)
@ -99,25 +99,25 @@ class AssignmentDetail(DetailView):
class AssignmentCreateView(CreateView): class AssignmentCreateView(CreateView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = Assignment model = Assignment
form_class = AssignmentForm form_class = AssignmentForm
class AssignmentUpdateView(UpdateView): class AssignmentUpdateView(UpdateView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = Assignment model = Assignment
form_class = AssignmentForm form_class = AssignmentForm
class AssignmentDeleteView(DeleteView): class AssignmentDeleteView(DeleteView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = Assignment model = Assignment
success_url_name = 'assignment_list' success_url_name = 'assignment_list'
class AssignmentSetPhaseView(SingleObjectMixin, RedirectView): class AssignmentSetPhaseView(SingleObjectMixin, RedirectView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = Assignment model = Assignment
url_name = 'assignment_detail' url_name = 'assignment_detail'
@ -137,14 +137,14 @@ class AssignmentSetPhaseView(SingleObjectMixin, RedirectView):
class AssignmentCandidateView(SingleObjectMixin, RedirectView): class AssignmentCandidateView(SingleObjectMixin, RedirectView):
required_permission = 'assignment.can_nominate_self' required_permission = 'assignments.can_nominate_self'
model = Assignment model = Assignment
url_name = 'assignment_detail' url_name = 'assignment_detail'
def pre_redirect(self, *args, **kwargs): def pre_redirect(self, *args, **kwargs):
assignment = self.get_object() assignment = self.get_object()
if (assignment.phase == assignment.PHASE_SEARCH or if (assignment.phase == assignment.PHASE_SEARCH or
self.request.user.has_perm('assignment.can_manage_assignments')): self.request.user.has_perm('assignments.can_manage')):
user = self.request.user user = self.request.user
if assignment.is_elected(user): if assignment.is_elected(user):
messages.error( messages.error(
@ -173,7 +173,7 @@ class AssignmentDeleteCandidateshipView(SingleObjectMixin, RedirectView):
def pre_redirect(self, *args, **kwargs): def pre_redirect(self, *args, **kwargs):
assignment = self.get_object() assignment = self.get_object()
if (assignment.phase == assignment.PHASE_SEARCH or if (assignment.phase == assignment.PHASE_SEARCH or
self.request.user.has_perm('assignment.can_manage_assignments')): self.request.user.has_perm('assignments.can_manage')):
user = self.request.user user = self.request.user
assignment.set_blocked(user) assignment.set_blocked(user)
messages.success(self.request, _( messages.success(self.request, _(
@ -184,7 +184,7 @@ class AssignmentDeleteCandidateshipView(SingleObjectMixin, RedirectView):
class AssignmentDeleteCandidateshipOtherView(SingleObjectMixin, QuestionView): class AssignmentDeleteCandidateshipOtherView(SingleObjectMixin, QuestionView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = Assignment model = Assignment
def get_question_message(self): def get_question_message(self):
@ -227,16 +227,16 @@ class AssignmentViewSet(ModelViewSet):
permission to see assignments and in case of create, update or destroy permission to see assignments and in case of create, update or destroy
requests the permission to manage assignments. requests the permission to manage assignments.
""" """
if (not request.user.has_perm('assignment.can_see_assignments') or if (not request.user.has_perm('assignments.can_see') or
(self.action in ('create', 'update', 'destroy') and not (self.action in ('create', 'update', 'destroy') and not
request.user.has_perm('assignment.can_manage_assignments'))): request.user.has_perm('assignments.can_manage'))):
self.permission_denied(request) self.permission_denied(request)
def get_serializer_class(self): def get_serializer_class(self):
""" """
Returns different serializer classes with respect to users permissions. Returns different serializer classes with respect to users permissions.
""" """
if self.request.user.has_perm('assignment.can_manage_assignments'): if self.request.user.has_perm('assignments.can_manage'):
serializer_class = AssignmentFullSerializer serializer_class = AssignmentFullSerializer
else: else:
serializer_class = AssignmentShortSerializer serializer_class = AssignmentShortSerializer
@ -244,7 +244,7 @@ class AssignmentViewSet(ModelViewSet):
class PollCreateView(SingleObjectMixin, RedirectView): class PollCreateView(SingleObjectMixin, RedirectView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = Assignment model = Assignment
url_name = 'assignment_detail' url_name = 'assignment_detail'
@ -254,9 +254,9 @@ class PollCreateView(SingleObjectMixin, RedirectView):
class PollUpdateView(PollFormView): class PollUpdateView(PollFormView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
poll_class = AssignmentPoll poll_class = AssignmentPoll
template_name = 'assignment/assignmentpoll_form.html' template_name = 'assignments/assignmentpoll_form.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(PollUpdateView, self).get_context_data(**kwargs) context = super(PollUpdateView, self).get_context_data(**kwargs)
@ -276,7 +276,7 @@ class PollUpdateView(PollFormView):
class SetPublishPollView(SingleObjectMixin, RedirectView): class SetPublishPollView(SingleObjectMixin, RedirectView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = AssignmentPoll model = AssignmentPoll
url_name = 'assignment_detail' url_name = 'assignment_detail'
allow_ajax = True allow_ajax = True
@ -293,7 +293,7 @@ class SetPublishPollView(SingleObjectMixin, RedirectView):
class SetElectedView(SingleObjectMixin, RedirectView): class SetElectedView(SingleObjectMixin, RedirectView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = Assignment model = Assignment
url_name = 'assignment_detail' url_name = 'assignment_detail'
allow_ajax = True allow_ajax = True
@ -320,7 +320,7 @@ class AssignmentPollDeleteView(DeleteView):
""" """
Delete an assignment poll object. Delete an assignment poll object.
""" """
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
model = AssignmentPoll model = AssignmentPoll
def pre_redirect(self, request, *args, **kwargs): def pre_redirect(self, request, *args, **kwargs):
@ -342,7 +342,7 @@ class AssignmentPollDeleteView(DeleteView):
class AssignmentPDF(PDFView): class AssignmentPDF(PDFView):
required_permission = 'assignment.can_see_assignments' required_permission = 'assignments.can_see'
top_space = 0 top_space = 0
def get_filename(self): def get_filename(self):
@ -539,7 +539,7 @@ class CreateRelatedAgendaItemView(_CreateRelatedAgendaItemView):
class AssignmentPollPDF(PDFView): class AssignmentPollPDF(PDFView):
required_permission = 'assignment.can_manage_assignments' required_permission = 'assignments.can_manage'
top_space = 0 top_space = 0
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):

View File

@ -14,7 +14,7 @@ class AssignmentWidget(Widget):
required_permission = 'core.can_manage_projector' required_permission = 'core.can_manage_projector'
default_column = 1 default_column = 1
default_weight = 50 default_weight = 50
template_name = 'assignment/widget_assignment.html' template_name = 'assignments/widget_assignment.html'
more_link_pattern_name = 'assignment_list' more_link_pattern_name = 'assignment_list'
def get_context_data(self, **context): def get_context_data(self, **context):

View File

@ -93,9 +93,9 @@ INSTALLED_APPS = (
'openslides.account', 'openslides.account',
'openslides.projector', 'openslides.projector',
'openslides.agenda', 'openslides.agenda',
'openslides.motion', 'openslides.motions',
'openslides.assignment', 'openslides.assignments',
'openslides.mediafile', 'openslides.mediafiles',
'openslides.config', 'openslides.config',
) )

View File

@ -1 +0,0 @@
default_app_config = 'openslides.mediafile.apps.MediafileAppConfig'

View File

@ -0,0 +1 @@
default_app_config = 'openslides.mediafiles.apps.MediafileAppConfig'

View File

@ -2,8 +2,8 @@ from django.apps import AppConfig
class MediafileAppConfig(AppConfig): class MediafileAppConfig(AppConfig):
name = 'openslides.mediafile' name = 'openslides.mediafiles'
verbose_name = 'OpenSlides Mediafile' verbose_name = 'OpenSlides Mediafiles'
def ready(self): def ready(self):
# Load main menu entry and widgets. # Load main menu entry and widgets.
@ -26,4 +26,4 @@ class MediafileAppConfig(AppConfig):
register_slide('mediafile', mediafile_presentation_as_slide, Mediafile) register_slide('mediafile', mediafile_presentation_as_slide, Mediafile)
# Register viewsets. # Register viewsets.
router.register('mediafile/mediafile', MediafileViewSet) router.register('mediafiles/mediafile', MediafileViewSet)

View File

@ -14,6 +14,6 @@ class MediafileMainMenuEntry(MainMenuEntry):
def check_permission(self): def check_permission(self):
return ( return (
self.request.user.has_perm('mediafile.can_see') or self.request.user.has_perm('mediafiles.can_see') or
self.request.user.has_perm('mediafile.can_upload') or self.request.user.has_perm('mediafiles.can_upload') or
self.request.user.has_perm('mediafile.can_manage')) self.request.user.has_perm('mediafiles.can_manage'))

View File

@ -5,7 +5,7 @@ from .models import Mediafile
class Index(indexes.SearchIndex, indexes.Indexable): class Index(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True) text = indexes.EdgeNgramField(document=True, use_template=True)
modelfilter_name = "Files" # verbose_name of model modelfilter_name = "Files" # verbose_name of model
modelfilter_value = "mediafile.mediafile" # 'app_name.model_name' modelfilter_value = "mediafiles.mediafile" # 'app_name.model_name'
def get_model(self): def get_model(self):
return Mediafile return Mediafile

View File

@ -26,4 +26,4 @@ def mediafile_presentation_as_slide(**kwargs):
raise SlideError raise SlideError
context = {'pdf': pdf, 'page_num': page_num, context = {'pdf': pdf, 'page_num': page_num,
'fullscreen': config['pdf_fullscreen']} 'fullscreen': config['pdf_fullscreen']}
return render_to_string('mediafile/presentation_slide.html', context) return render_to_string('mediafiles/presentation_slide.html', context)

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -8,7 +8,7 @@
{% block content %} {% block content %}
<h1>{% trans 'Files' %} <h1>{% trans 'Files' %}
<small class="pull-right"> <small class="pull-right">
{% if perms.mediafile.can_upload %} {% if perms.mediafiles.can_upload %}
<a href="{% url 'mediafile_create' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New file' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a> <a href="{% url 'mediafile_create' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New file' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
{% endif %} {% endif %}
</small> </small>
@ -20,7 +20,7 @@
<th class="optional-small">{% trans 'Size' %}</th> <th class="optional-small">{% trans 'Size' %}</th>
<th class="optional">{% trans 'Upload time' %}</th> <th class="optional">{% trans 'Upload time' %}</th>
<th class="optional">{% trans 'Uploaded by' %}</th> <th class="optional">{% trans 'Uploaded by' %}</th>
{% if perms.mediafile.can_manage or perms.mediafile.can_upload %} {% if perms.mediafiles.can_manage or perms.mediafiles.can_upload %}
<th class="mini_width">{% trans "Actions" %}</th> <th class="mini_width">{% trans "Actions" %}</th>
{% endif %} {% endif %}
</tr> </tr>
@ -31,13 +31,13 @@
<td class="optional-small">{{ mediafile.get_filesize }}</td> <td class="optional-small">{{ mediafile.get_filesize }}</td>
<td class="optional">{{ mediafile.timestamp }}</td> <td class="optional">{{ mediafile.timestamp }}</td>
<td class="optional"><a href="{{ mediafile.uploader|absolute_url }}">{{ mediafile.uploader }}</a></td> <td class="optional"><a href="{{ mediafile.uploader|absolute_url }}">{{ mediafile.uploader }}</a></td>
{% if perms.mediafile.can_manage or perms.mediafile.can_upload %} {% if perms.mediafiles.can_manage or perms.mediafiles.can_upload %}
<td> <td>
{% if mediafile.with_action_buttons %} {% if mediafile.with_action_buttons %}
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
<a href="{{ mediafile|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini"><i class="icon-pencil"></i></a> <a href="{{ mediafile|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini"><i class="icon-pencil"></i></a>
<a href="{{ mediafile|absolute_url:'delete' }}" rel="tooltip" data-original-title="{% trans 'Delete' %}" class="btn btn-mini"><i class="icon-remove"></i></a> <a href="{{ mediafile|absolute_url:'delete' }}" rel="tooltip" data-original-title="{% trans 'Delete' %}" class="btn btn-mini"><i class="icon-remove"></i></a>
{% if perms.mediafile.can_manage and mediafile.is_presentable %}{% if mediafile.filetype in mediafile.PRESENTABLE_FILE_TYPES %} {% if perms.mediafiles.can_manage and mediafile.is_presentable %}{% if mediafile.filetype in mediafile.PRESENTABLE_FILE_TYPES %}
<a href="{{ mediafile|absolute_url:'projector' }}" class="activate_link choose-pdf btn {% if mediafile.is_active_slide %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}"> <a href="{{ mediafile|absolute_url:'projector' }}" class="activate_link choose-pdf btn {% if mediafile.is_active_slide %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if mediafile.is_active_slide %}icon-white{% endif %}"> <i class="icon-facetime-video {% if mediafile.is_active_slide %}icon-white{% endif %}">
</i> </i>

View File

@ -1,7 +1,7 @@
{% load i18n %} {% load i18n %}
{% load highlight %} {% load highlight %}
{% if perms.mediafile.can_see %} {% if perms.mediafiles.can_see %}
<li> <li>
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br> <a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
<span class="app">{% trans "File" %}</a></span><br> <span class="app">{% trans "File" %}</a></span><br>

View File

@ -18,16 +18,16 @@ class MediafileListView(ListView):
model = Mediafile model = Mediafile
def check_permission(self, request, *args, **kwargs): def check_permission(self, request, *args, **kwargs):
return (request.user.has_perm('mediafile.can_see') or return (request.user.has_perm('mediafiles.can_see') or
request.user.has_perm('mediafile.can_upload') or request.user.has_perm('mediafiles.can_upload') or
request.user.has_perm('mediafile.can_manage')) request.user.has_perm('mediafiles.can_manage'))
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
context = super(MediafileListView, self).get_context_data(*args, **kwargs) context = super(MediafileListView, self).get_context_data(*args, **kwargs)
for mediafile in context['mediafile_list']: for mediafile in context['mediafile_list']:
if self.request.user.has_perm('mediafile.can_manage'): if self.request.user.has_perm('mediafiles.can_manage'):
mediafile.with_action_buttons = True mediafile.with_action_buttons = True
elif self.request.user.has_perm('mediafile.can_upload') and self.request.user == mediafile.uploader: elif self.request.user.has_perm('mediafiles.can_upload') and self.request.user == mediafile.uploader:
mediafile.with_action_buttons = True mediafile.with_action_buttons = True
else: else:
mediafile.with_action_buttons = False mediafile.with_action_buttons = False
@ -47,7 +47,7 @@ class MediafileViewMixin(object):
def get_form(self, form_class): def get_form(self, form_class):
form_kwargs = self.get_form_kwargs() form_kwargs = self.get_form_kwargs()
if not self.request.user.has_perm('mediafile.can_manage'): if not self.request.user.has_perm('mediafiles.can_manage'):
return MediafileNormalUserForm(**form_kwargs) return MediafileNormalUserForm(**form_kwargs)
else: else:
return MediafileManagerForm(**form_kwargs) return MediafileManagerForm(**form_kwargs)
@ -58,7 +58,7 @@ class MediafileViewMixin(object):
he has to set the uploader in the given form field. Then this he has to set the uploader in the given form field. Then this
method only calls super. Else it sets the requesting user as uploader. method only calls super. Else it sets the requesting user as uploader.
""" """
if not self.request.user.has_perm('mediafile.can_manage'): if not self.request.user.has_perm('mediafiles.can_manage'):
self.object.uploader = self.request.user self.object.uploader = self.request.user
return super(MediafileViewMixin, self).manipulate_object(*args, **kwargs) return super(MediafileViewMixin, self).manipulate_object(*args, **kwargs)
@ -67,7 +67,7 @@ class MediafileCreateView(MediafileViewMixin, CreateView):
""" """
View to upload a new file. View to upload a new file.
""" """
required_permission = 'mediafile.can_upload' required_permission = 'mediafiles.can_upload'
def get_form_kwargs(self, *args, **kwargs): def get_form_kwargs(self, *args, **kwargs):
form_kwargs = super(MediafileCreateView, self).get_form_kwargs(*args, **kwargs) form_kwargs = super(MediafileCreateView, self).get_form_kwargs(*args, **kwargs)
@ -81,8 +81,8 @@ class MediafileUpdateView(MediafileViewMixin, UpdateView):
View to edit the entry of an uploaded file. View to edit the entry of an uploaded file.
""" """
def check_permission(self, request, *args, **kwargs): def check_permission(self, request, *args, **kwargs):
return (request.user.has_perm('mediafile.can_manage') or return (request.user.has_perm('mediafiles.can_manage') or
(request.user.has_perm('mediafile.can_upload') and (request.user.has_perm('mediafiles.can_upload') and
self.get_object().uploader == self.request.user)) self.get_object().uploader == self.request.user))
def get_form_kwargs(self, *args, **kwargs): def get_form_kwargs(self, *args, **kwargs):
@ -99,8 +99,8 @@ class MediafileDeleteView(DeleteView):
success_url_name = 'mediafile_list' success_url_name = 'mediafile_list'
def check_permission(self, request, *args, **kwargs): def check_permission(self, request, *args, **kwargs):
return (request.user.has_perm('mediafile.can_manage') or return (request.user.has_perm('mediafiles.can_manage') or
(request.user.has_perm('mediafile.can_upload') and self.get_object().uploader == self.request.user)) (request.user.has_perm('mediafiles.can_upload') and self.get_object().uploader == self.request.user))
def on_clicked_yes(self, *args, **kwargs): def on_clicked_yes(self, *args, **kwargs):
"""Deletes the file in the filesystem, if user clicks "Yes".""" """Deletes the file in the filesystem, if user clicks "Yes"."""
@ -216,9 +216,9 @@ class MediafileViewSet(ModelViewSet):
permission to see mediafile objects and in case of create, update or permission to see mediafile objects and in case of create, update or
destroy requests the permission to manage mediafile objects. destroy requests the permission to manage mediafile objects.
""" """
# TODO: Use mediafile.can_upload permission to create and update some # TODO: Use mediafiles.can_upload permission to create and update some
# objects but restricted concerning the uploader. # objects but restricted concerning the uploader.
if (not request.user.has_perm('mediafile.can_see') or if (not request.user.has_perm('mediafiles.can_see') or
(self.action in ('create', 'update', 'destroy') and not (self.action in ('create', 'update', 'destroy') and not
request.user.has_perm('mediafile.can_manage'))): request.user.has_perm('mediafiles.can_manage'))):
self.permission_denied(request) self.permission_denied(request)

View File

@ -15,7 +15,7 @@ class PDFPresentationWidget(Widget):
required_permission = 'core.can_manage_projector' required_permission = 'core.can_manage_projector'
default_column = 1 default_column = 1
default_weight = 75 default_weight = 75
template_name = 'mediafile/widget_pdfpresentation.html' template_name = 'mediafiles/widget_pdfpresentation.html'
icon_css_class = 'icon-align-left' icon_css_class = 'icon-align-left'
more_link_pattern_name = 'mediafile_list' more_link_pattern_name = 'mediafile_list'
# javascript_files = None # TODO: Add pdf.js stuff here. # javascript_files = None # TODO: Add pdf.js stuff here.

View File

@ -1 +0,0 @@
default_app_config = 'openslides.motion.apps.MotionAppConfig'

View File

@ -0,0 +1 @@
default_app_config = 'openslides.motions.apps.MotionAppConfig'

View File

@ -3,7 +3,7 @@ from django.db.models.signals import post_migrate
class MotionAppConfig(AppConfig): class MotionAppConfig(AppConfig):
name = 'openslides.motion' name = 'openslides.motions'
verbose_name = 'OpenSlides Motion' verbose_name = 'OpenSlides Motion'
def ready(self): def ready(self):
@ -25,10 +25,10 @@ class MotionAppConfig(AppConfig):
# Register slides. # Register slides.
Motion = self.get_model('Motion') Motion = self.get_model('Motion')
MotionPoll = self.get_model('MotionPoll') MotionPoll = self.get_model('MotionPoll')
register_slide_model(Motion, 'motion/slide.html') register_slide_model(Motion, 'motions/slide.html')
register_slide_model(MotionPoll, 'motion/motionpoll_slide.html') register_slide_model(MotionPoll, 'motions/motionpoll_slide.html')
# Register viewsets. # Register viewsets.
router.register('motion/category', CategoryViewSet) router.register('motions/category', CategoryViewSet)
router.register('motion/motion', MotionViewSet) router.register('motions/motion', MotionViewSet)
router.register('motion/workflow', WorkflowViewSet) router.register('motions/workflow', WorkflowViewSet)

View File

@ -3,7 +3,7 @@ import collections
from django import forms from django import forms
from django.utils.translation import ugettext_lazy from django.utils.translation import ugettext_lazy
from openslides.mediafile.models import Mediafile from openslides.mediafiles.models import Mediafile
from openslides.utils.forms import (CleanHtmlFormMixin, CssClassMixin, from openslides.utils.forms import (CleanHtmlFormMixin, CssClassMixin,
CSVImportForm, LocalizedModelChoiceField) CSVImportForm, LocalizedModelChoiceField)
from openslides.users.models import User from openslides.users.models import User

View File

@ -8,7 +8,7 @@ class MotionMainMenuEntry(MainMenuEntry):
Main menu entry for the motion app. Main menu entry for the motion app.
""" """
verbose_name = ugettext_lazy('Motions') verbose_name = ugettext_lazy('Motions')
required_permission = 'motion.can_see_motion' required_permission = 'motions.can_see'
default_weight = 30 default_weight = 30
pattern_name = 'motion_list' pattern_name = 'motion_list'
icon_css_class = 'glyphicon-file' icon_css_class = 'glyphicon-file'

View File

@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy, ugettext_noop
from openslides.config.api import config from openslides.config.api import config
from openslides.core.models import Tag from openslides.core.models import Tag
from openslides.mediafile.models import Mediafile from openslides.mediafiles.models import Mediafile
from openslides.poll.models import (BaseOption, BasePoll, BaseVote, CollectDefaultVotesMixin) from openslides.poll.models import (BaseOption, BasePoll, BaseVote, CollectDefaultVotesMixin)
from openslides.projector.models import SlideMixin from openslides.projector.models import SlideMixin
from jsonfield import JSONField from jsonfield import JSONField
@ -85,10 +85,10 @@ class Motion(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
('can_see_motion', ugettext_noop('Can see motions')), ('can_see', ugettext_noop('Can see motions')),
('can_create_motion', ugettext_noop('Can create motions')), ('can_create', ugettext_noop('Can create motions')),
('can_support_motion', ugettext_noop('Can support motions')), ('can_support', ugettext_noop('Can support motions')),
('can_manage_motion', ugettext_noop('Can manage motions')), ('can_manage', ugettext_noop('Can manage motions')),
) )
ordering = ('identifier', ) ordering = ('identifier', )
verbose_name = ugettext_noop('Motion') verbose_name = ugettext_noop('Motion')
@ -505,18 +505,18 @@ class Motion(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
* reset_state * reset_state
""" """
actions = { actions = {
'see': (person.has_perm('motion.can_see_motion') and 'see': (person.has_perm('motions.can_see') and
(not self.state.required_permission_to_see or (not self.state.required_permission_to_see or
person.has_perm(self.state.required_permission_to_see) or person.has_perm(self.state.required_permission_to_see) or
self.is_submitter(person))), self.is_submitter(person))),
'update': (person.has_perm('motion.can_manage_motion') or 'update': (person.has_perm('motions.can_manage') or
(self.is_submitter(person) and (self.is_submitter(person) and
self.state.allow_submitter_edit)), self.state.allow_submitter_edit)),
'delete': person.has_perm('motion.can_manage_motion'), 'delete': person.has_perm('motions.can_manage'),
'create_poll': (person.has_perm('motion.can_manage_motion') and 'create_poll': (person.has_perm('motions.can_manage') and
self.state.allow_create_poll), self.state.allow_create_poll),
'support': (self.state.allow_support and 'support': (self.state.allow_support and
@ -527,9 +527,9 @@ class Motion(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
'unsupport': (self.state.allow_support and 'unsupport': (self.state.allow_support and
self.is_supporter(person)), self.is_supporter(person)),
'change_state': person.has_perm('motion.can_manage_motion'), 'change_state': person.has_perm('motions.can_manage'),
'reset_state': person.has_perm('motion.can_manage_motion')} 'reset_state': person.has_perm('motions.can_manage')}
actions['edit'] = actions['update'] actions['edit'] = actions['update']
@ -855,7 +855,7 @@ class State(RESTModelMixin, models.Model):
To use this feature change the database entry of a state object and add To use this feature change the database entry of a state object and add
your favourite permission string. You can do this e. g. by editing the your favourite permission string. You can do this e. g. by editing the
definitions in create_builtin_workflows() in openslides/motion/signals.py. definitions in create_builtin_workflows() in openslides/motions/signals.py.
""" """
allow_support = models.BooleanField(default=False) allow_support = models.BooleanField(default=False)

View File

@ -5,7 +5,7 @@ from .models import Motion
class Index(indexes.SearchIndex, indexes.Indexable): class Index(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True) text = indexes.EdgeNgramField(document=True, use_template=True)
modelfilter_name = "Motions" # verbose_name of model modelfilter_name = "Motions" # verbose_name of model
modelfilter_value = "motion.motion" # 'app_name.model_name' modelfilter_value = "motions.motion" # 'app_name.model_name'
def get_model(self): def get_model(self):
return Motion return Motion

View File

@ -9,7 +9,7 @@
<h1> <h1>
{% trans "Categories" %} {% trans "Categories" %}
<small class="pull-right"> <small class="pull-right">
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<a href="{% url 'motion_category_create' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New category' %}"><i class="icon-plus icon-white"></i> {% trans 'New' %}</a> <a href="{% url 'motion_category_create' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New category' %}"><i class="icon-plus icon-white"></i> {% trans 'New' %}</a>
{% endif %} {% endif %}
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a> <a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>

View File

@ -51,7 +51,7 @@
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> <span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
</a> </a>
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion or perms.agenda.can_manage_agenda or allowed_actions.edit %} {% if perms.motions.can_manage or perms.agenda.can_manage or allowed_actions.edit %}
<div class="btn-group"> <div class="btn-group">
<a data-toggle="dropdown" class="btn btn-sm btn-default dropdown-toggle"> <a data-toggle="dropdown" class="btn btn-sm btn-default dropdown-toggle">
<span class="optional-small">{% trans 'More actions' %}</span> <span class="caret"></span> <span class="optional-small">{% trans 'More actions' %}</span> <span class="caret"></span>
@ -63,7 +63,7 @@
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
{% trans 'Edit motion' %}</a></li> {% trans 'Edit motion' %}</a></li>
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<!-- delete --> <!-- delete -->
{% if allowed_actions.delete %} {% if allowed_actions.delete %}
<li><a href="{{ motion|absolute_url:'delete' }}"> <li><a href="{{ motion|absolute_url:'delete' }}">
@ -72,7 +72,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<!-- create agenda item --> <!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage %}
<li><a href="{% url 'motion_create_agenda' motion.id %}"> <li><a href="{% url 'motion_create_agenda' motion.id %}">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
{% trans 'New agenda item' %}</a></li> {% trans 'New agenda item' %}</a></li>
@ -142,7 +142,7 @@
{% if version == motion.active_version %} {% if version == motion.active_version %}
<span class="badge badge-success" title="{% trans 'This version is authorized' %}"><i class="icon-ok icon-white"></i></span> <span class="badge badge-success" title="{% trans 'This version is authorized' %}"><i class="icon-ok icon-white"></i></span>
{% else %} {% else %}
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<a class="btn btn-default btn-sm" href="{% url 'motion_version_permit' motion.id version.version_number %}" title="{% trans 'Permit this version' %}"><i class="icon-ok"></i></a> <a class="btn btn-default btn-sm" href="{% url 'motion_version_permit' motion.id version.version_number %}" title="{% trans 'Permit this version' %}"><i class="icon-ok"></i></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -157,7 +157,7 @@
<a href="{{ version|absolute_url }}" title="{% trans 'Show' %}" class="btn btn-default btn-xs"> <a href="{{ version|absolute_url }}" title="{% trans 'Show' %}" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span> <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
</a> </a>
{% if perms.motion.can_manage_motion and version != motion.active_version %} {% if perms.motions.can_manage and version != motion.active_version %}
<a href="{{ version|absolute_url:'delete' }}" title="{% trans 'Delete' %}" class="btn btn-default btn-xs"> <a href="{{ version|absolute_url:'delete' }}" title="{% trans 'Delete' %}" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</a> </a>
@ -173,7 +173,7 @@
{% endwith %} {% endwith %}
<!-- Log --> <!-- Log -->
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<p> <p>
<div class="btn-group" data-toggle="buttons-checkbox"> <div class="btn-group" data-toggle="buttons-checkbox">
<button type="button" class="btn btn-default btn-sm" data-toggle="collapse" data-target="#log"> <button type="button" class="btn btn-default btn-sm" data-toggle="collapse" data-target="#log">
@ -227,7 +227,7 @@
{% if polls.count > 1 %} {% if polls.count > 1 %}
{{ poll.poll_number|ordinal|safe }} {% trans "vote" %}: {{ poll.poll_number|ordinal|safe }} {% trans "vote" %}:
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
{% if polls.count > 1 %}<br>{% endif %} {% if polls.count > 1 %}<br>{% endif %}
<a class="btn btn-default btn-sm activate_link {% if poll.is_active_slide %}btn-primary{% endif %}" <a class="btn btn-default btn-sm activate_link {% if poll.is_active_slide %}btn-primary{% endif %}"
href="{{ poll|absolute_url:'projector' }}" href="{{ poll|absolute_url:'projector' }}"
@ -326,7 +326,7 @@
{% endif %} {% endif %}
<!-- Support/Unsupport button --> <!-- Support/Unsupport button -->
{% if perms.motion.can_support_motion and 'motion_min_supporters'|get_config > 0 %} {% if perms.motions.can_support and 'motion_min_supporters'|get_config > 0 %}
{% if allowed_actions.unsupport %} {% if allowed_actions.unsupport %}
<br><br> <br><br>
<a href="{% url 'motion_unsupport' motion.id %}" class="btn btn-default btn-sm"> <a href="{% url 'motion_unsupport' motion.id %}" class="btn btn-default btn-sm">
@ -348,7 +348,7 @@
{% endif %} {% endif %}
</div> <!--/well--> </div> <!--/well-->
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<!-- Manage motion box --> <!-- Manage motion box -->
<div class="well"> <div class="well">
<h4>{% trans "Manage motion" %}</h4> <h4>{% trans "Manage motion" %}</h4>

View File

@ -25,8 +25,8 @@
<h1> <h1>
{% trans "Motions" %} {% trans "Motions" %}
<small class="pull-right"> <small class="pull-right">
{% if perms.motion.can_create_motion %} {% if perms.motions.can_create %}
{% if not 'motion_stop_submitting'|get_config or perms.motion.can_manage_motion %} {% if not 'motion_stop_submitting'|get_config or perms.motions.can_manage %}
<a href="{% url 'motion_create' %}" class="btn btn-sm btn-primary" <a href="{% url 'motion_create' %}" class="btn btn-sm btn-primary"
rel="tooltip" data-original-title="{% trans 'New motion' %}"> rel="tooltip" data-original-title="{% trans 'New motion' %}">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
@ -41,7 +41,7 @@
<span class="optional-small"> {% trans 'Tags' %}</span> <span class="optional-small"> {% trans 'Tags' %}</span>
</a> </a>
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<a href="{% url 'motion_category_list' %}" class="btn btn-default btn-sm" <a href="{% url 'motion_category_list' %}" class="btn btn-default btn-sm"
rel="tooltip" data-original-title="{% trans 'Manage categories' %}"> rel="tooltip" data-original-title="{% trans 'Manage categories' %}">
<span class="glyphicon glyphicon-th-large" aria-hidden="true"></span> <span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>
@ -71,7 +71,7 @@
<th class="optional">{% trans "Supporters" %}</th> <th class="optional">{% trans "Supporters" %}</th>
{% endif %} {% endif %}
<th class="optional">{% trans "Last changes" %}</th> <th class="optional">{% trans "Last changes" %}</th>
{% if perms.motion.can_manage_motion or perms.core.can_manage_projector %} {% if perms.motions.can_manage or perms.core.can_manage_projector %}
<th class="mini_width">{% trans "Actions" %}</th> <th class="mini_width">{% trans "Actions" %}</th>
{% endif %} {% endif %}
</tr> </tr>
@ -120,7 +120,7 @@
<i class="icon-warning-sign icon-white"></i> <i class="icon-warning-sign icon-white"></i>
</a> </a>
{% endif %}</td> {% endif %}</td>
{% if perms.motion.can_manage_motion or perms.core.can_manage_projector %} {% if perms.motions.can_manage or perms.core.can_manage_projector %}
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
{% if perms.core.can_manage_projector %} {% if perms.core.can_manage_projector %}
@ -130,7 +130,7 @@
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> <span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
</a> </a>
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<a href="{{ motion|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}" <a href="{{ motion|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}"
class="btn btn-default btn-sm"> class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>

View File

@ -26,7 +26,7 @@
rel="tooltip" data-original-title="{% trans 'Show vote result' %}"> rel="tooltip" data-original-title="{% trans 'Show vote result' %}">
<i class="icon-facetime-video {% if poll.is_active_slide %}icon-white{% endif %}"></i> {% trans "Vote result" %}</a> <i class="icon-facetime-video {% if poll.is_active_slide %}icon-white{% endif %}"></i> {% trans "Vote result" %}</a>
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<a class="btn btn-mini" href="{{ poll|absolute_url:'delete' }}" <a class="btn btn-mini" href="{{ poll|absolute_url:'delete' }}"
rel="tooltip" data-original-title="{% trans 'Delete Vote' %}"><i class="icon-remove"></i></a> rel="tooltip" data-original-title="{% trans 'Delete Vote' %}"><i class="icon-remove"></i></a>
{% endif %} {% endif %}

View File

@ -11,7 +11,7 @@
rel="tooltip" data-original-title="{% trans 'Show' %}"> rel="tooltip" data-original-title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if motion.is_active_slide %}icon-white{% endif %}"></i> <i class="icon-facetime-video {% if motion.is_active_slide %}icon-white{% endif %}"></i>
</a>&nbsp; </a>&nbsp;
{% if perms.motion.can_manage_motion %} {% if perms.motions.can_manage %}
<a href="{{ motion|absolute_url:'update' }}" <a href="{{ motion|absolute_url:'update' }}"
rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right"> rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i> <i class="icon-pencil"></i>

View File

@ -1,7 +1,7 @@
{% load i18n %} {% load i18n %}
{% load highlight %} {% load highlight %}
{% if perms.motion.can_see_motion %} {% if perms.motions.can_see %}
<li> <li>
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br> <a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
<span class="app">{% trans "Motion" %}</a></span><br> <span class="app">{% trans "Motion" %}</a></span><br>

View File

@ -2,9 +2,8 @@ from django.conf.urls import patterns, url
from . import views from . import views
# TODO: define the Views inhere
urlpatterns = patterns( urlpatterns = patterns(
'openslides.motion.views', '',
url(r'^$', url(r'^$',
views.MotionListView.as_view(), views.MotionListView.as_view(),
name='motion_list'), name='motion_list'),

View File

@ -32,11 +32,12 @@ class MotionListView(ListView):
View, to list all motions. View, to list all motions.
""" """
model = Motion model = Motion
required_permission = 'motion.can_see_motion' required_permission = 'motions.can_see'
# The template name must be set explicitly because the overridden method # The template name must be set explicitly because the overridden method
# get_queryset() does not return a QuerySet any more so that Django can't # get_queryset() does not return a QuerySet any more so that Django can't
# generate the template name from the name of the model. # generate the template name from the name of the model.
template_name = 'motion/motion_list.html'
template_name = 'motions/motion_list.html'
# The attribute context_object_name must be set explicitly because the # The attribute context_object_name must be set explicitly because the
# overridden method get_queryset() does not return a QuerySet any more so # overridden method get_queryset() does not return a QuerySet any more so
# that Django can't generate the context_object_name from the name of the # that Django can't generate the context_object_name from the name of the
@ -156,13 +157,13 @@ class MotionEditMixin(object):
""" """
form_classes = [] form_classes = []
if (self.request.user.has_perm('motion.can_manage_motion') and if (self.request.user.has_perm('motions.can_manage') and
(config['motion_identifier'] == 'manually' or type(self) == MotionUpdateView)): (config['motion_identifier'] == 'manually' or type(self) == MotionUpdateView)):
form_classes.append(MotionIdentifierMixin) form_classes.append(MotionIdentifierMixin)
form_classes.append(BaseMotionForm) form_classes.append(BaseMotionForm)
if self.request.user.has_perm('motion.can_manage_motion'): if self.request.user.has_perm('motions.can_manage'):
form_classes.append(MotionSubmitterMixin) form_classes.append(MotionSubmitterMixin)
form_classes.append(MotionCategoryMixin) form_classes.append(MotionCategoryMixin)
if config['motion_min_supporters'] > 0: if config['motion_min_supporters'] > 0:
@ -185,13 +186,13 @@ class MotionCreateView(MotionEditMixin, CreateView):
def check_permission(self, request, *args, **kwargs): def check_permission(self, request, *args, **kwargs):
""" """
Checks whether the requesting user can submit a new motion. He needs Checks whether the requesting user can submit a new motion. He needs
at least the permission 'motion.can_create_motion'. If the submitting at least the permission 'motions.can_create'. If the submitting
of new motions by non-staff users is stopped via config variable of new motions by non-staff users is stopped via config variable
'motion_stop_submitting', the requesting user needs also to have 'motion_stop_submitting', the requesting user needs also to have
'motion.can_manage_motion'. 'motions.can_manage'.
""" """
if request.user.has_perm('motion.can_create_motion'): if request.user.has_perm('motions.can_create'):
return not config['motion_stop_submitting'] or request.user.has_perm('motion.can_manage_motion') return not config['motion_stop_submitting'] or request.user.has_perm('motions.can_manage')
return False return False
def form_valid(self, form): def form_valid(self, form):
@ -216,7 +217,7 @@ class MotionCreateView(MotionEditMixin, CreateView):
""" """
initial = super().get_initial() initial = super().get_initial()
initial['text'] = config['motion_preamble'] initial['text'] = config['motion_preamble']
if self.request.user.has_perm('motion.can_manage_motion'): if self.request.user.has_perm('motions.can_manage'):
initial['workflow'] = config['motion_workflow'] initial['workflow'] = config['motion_workflow']
return initial return initial
@ -297,7 +298,7 @@ class MotionUpdateView(MotionEditMixin, UpdateView):
response = super().form_valid(form) response = super().form_valid(form)
self.write_log() self.write_log()
if (config['motion_remove_supporters'] and self.object.state.allow_support and if (config['motion_remove_supporters'] and self.object.state.allow_support and
not self.request.user.has_perm('motion.can_manage_motion')): not self.request.user.has_perm('motions.can_manage')):
self.object.clear_supporters() self.object.clear_supporters()
self.object.write_log([ugettext_noop('All supporters removed')], self.request.user) self.object.write_log([ugettext_noop('All supporters removed')], self.request.user)
return response return response
@ -320,7 +321,7 @@ class MotionUpdateView(MotionEditMixin, UpdateView):
def get_initial(self): def get_initial(self):
initial = super().get_initial() initial = super().get_initial()
if self.request.user.has_perm('motion.can_manage_motion'): if self.request.user.has_perm('motions.can_manage'):
initial['workflow'] = self.object.state.workflow initial['workflow'] = self.object.state.workflow
return initial return initial
@ -366,7 +367,7 @@ class VersionDeleteView(DeleteView):
View to delete a motion version. View to delete a motion version.
""" """
model = MotionVersion model = MotionVersion
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
success_url_name = 'motion_detail' success_url_name = 'motion_detail'
def get_object(self): def get_object(self):
@ -398,7 +399,7 @@ class VersionPermitView(SingleObjectMixin, QuestionView):
""" """
model = Motion model = Motion
final_message = ugettext_lazy('Version successfully permitted.') final_message = ugettext_lazy('Version successfully permitted.')
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
question_url_name = 'motion_version_detail' question_url_name = 'motion_version_detail'
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
@ -442,7 +443,7 @@ class VersionDiffView(DetailView):
Show diff between two versions of a motion. Show diff between two versions of a motion.
""" """
model = Motion model = Motion
template_name = 'motion/motion_diff.html' template_name = 'motions/motion_diff.html'
def check_permission(self, request, *args, **kwargs): def check_permission(self, request, *args, **kwargs):
""" """
@ -486,7 +487,7 @@ class SupportView(SingleObjectMixin, QuestionView):
If self.support is False, the view will remove a request.user from the supporter list. If self.support is False, the view will remove a request.user from the supporter list.
""" """
required_permission = 'motion.can_support_motion' required_permission = 'motions.can_support'
model = Motion model = Motion
support = True support = True
@ -552,12 +553,12 @@ class MotionViewSet(ModelViewSet):
permission to see motions and in case of create, update or permission to see motions and in case of create, update or
destroy requests the permission to manage motions. destroy requests the permission to manage motions.
""" """
# TODO: Use motion.can_create_motion permission and # TODO: Use motions.can_create permission and
# motion.can_support_motion permission to create and update some # motions.can_support permission to create and update some
# objects but restricted concerning the requesting user. # objects but restricted concerning the requesting user.
if (not request.user.has_perm('motion.can_see_motion') or if (not request.user.has_perm('motions.can_see') or
(self.action in ('create', 'update', 'destroy') and not (self.action in ('create', 'update', 'destroy') and not
request.user.has_perm('motion.can_manage_motion'))): request.user.has_perm('motions.can_manage'))):
self.permission_denied(request) self.permission_denied(request)
@ -565,7 +566,7 @@ class PollCreateView(SingleObjectMixin, RedirectView):
""" """
View to create a poll for a motion. View to create a poll for a motion.
""" """
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
model = Motion model = Motion
url_name = 'motionpoll_detail' url_name = 'motionpoll_detail'
@ -589,7 +590,7 @@ class PollMixin(object):
Mixin for the PollUpdateView and the PollDeleteView. Mixin for the PollUpdateView and the PollDeleteView.
""" """
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
success_url_name = 'motion_detail' success_url_name = 'motion_detail'
def get_object(self): def get_object(self):
@ -626,7 +627,7 @@ class PollUpdateView(PollMixin, PollFormView):
Poll Class to use for this view. Poll Class to use for this view.
""" """
template_name = 'motion/motionpoll_form.html' template_name = 'motions/motionpoll_form.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
""" """
@ -675,7 +676,7 @@ class PollPDFView(PollMixin, PDFView):
Generates a ballotpaper. Generates a ballotpaper.
""" """
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
top_space = 0 top_space = 0
def get_filename(self): def get_filename(self):
@ -706,7 +707,7 @@ class MotionSetStateView(SingleObjectMixin, RedirectView):
If self.reset is False, the new state is taken from url. If self.reset is False, the new state is taken from url.
If self.reset is True, the default state is taken. If self.reset is True, the default state is taken.
""" """
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
url_name = 'motion_detail' url_name = 'motion_detail'
model = Motion model = Motion
reset = False reset = False
@ -769,7 +770,7 @@ class MotionPDFView(SingleObjectMixin, PDFView):
PDF. PDF.
""" """
if self.print_all_motions: if self.print_all_motions:
is_allowed = request.user.has_perm('motion.can_see_motion') is_allowed = request.user.has_perm('motions.can_see')
else: else:
is_allowed = self.get_object().get_allowed_actions(request.user)['see'] is_allowed = self.get_object().get_allowed_actions(request.user)['see']
return is_allowed return is_allowed
@ -811,13 +812,13 @@ class MotionPDFView(SingleObjectMixin, PDFView):
class CategoryListView(ListView): class CategoryListView(ListView):
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
model = Category model = Category
class CategoryCreateView(CreateView): class CategoryCreateView(CreateView):
fields = ("name", "prefix",) fields = ("name", "prefix",)
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
model = Category model = Category
success_url_name = 'motion_category_list' success_url_name = 'motion_category_list'
url_name_args = [] url_name_args = []
@ -825,14 +826,14 @@ class CategoryCreateView(CreateView):
class CategoryUpdateView(UpdateView): class CategoryUpdateView(UpdateView):
fields = ("name", "prefix",) fields = ("name", "prefix",)
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
model = Category model = Category
success_url_name = 'motion_category_list' success_url_name = 'motion_category_list'
url_name_args = [] url_name_args = []
class CategoryDeleteView(DeleteView): class CategoryDeleteView(DeleteView):
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
model = Category model = Category
question_url_name = 'motion_category_list' question_url_name = 'motion_category_list'
url_name_args = [] url_name_args = []
@ -852,9 +853,9 @@ class CategoryViewSet(ModelViewSet):
permission to see motions and in case of create, update or destroy permission to see motions and in case of create, update or destroy
requests the permission to manage motions. requests the permission to manage motions.
""" """
if (not request.user.has_perm('motion.can_see_motion') or if (not request.user.has_perm('motions.can_see') or
(self.action in ('create', 'update', 'destroy') and not (self.action in ('create', 'update', 'destroy') and not
request.user.has_perm('motion.can_manage_motion'))): request.user.has_perm('motions.can_manage'))):
self.permission_denied(request) self.permission_denied(request)
@ -863,9 +864,9 @@ class MotionCSVImportView(CSVImportView):
Imports motions from an uploaded csv file. Imports motions from an uploaded csv file.
""" """
form_class = MotionCSVImportForm form_class = MotionCSVImportForm
required_permission = 'motion.can_manage_motion' required_permission = 'motions.can_manage'
success_url_name = 'motion_list' success_url_name = 'motion_list'
template_name = 'motion/motion_form_csv_import.html' template_name = 'motions/motion_form_csv_import.html'
def get_initial(self, *args, **kwargs): def get_initial(self, *args, **kwargs):
""" """
@ -897,7 +898,7 @@ class WorkflowViewSet(ModelViewSet):
permission to see motions and in case of create, update or destroy permission to see motions and in case of create, update or destroy
requests the permission to manage motions. requests the permission to manage motions.
""" """
if (not request.user.has_perm('motion.can_see_motion') or if (not request.user.has_perm('motions.can_see') or
(self.action in ('create', 'update', 'destroy') and not (self.action in ('create', 'update', 'destroy') and not
request.user.has_perm('motion.can_manage_motion'))): request.user.has_perm('motions.can_manage'))):
self.permission_denied(request) self.permission_denied(request)

View File

@ -15,7 +15,7 @@ class MotionWidget(Widget):
default_column = 1 default_column = 1
default_weight = 40 default_weight = 40
icon_css_class = 'icon-file' icon_css_class = 'icon-file'
template_name = 'motion/widget_motion.html' template_name = 'motions/widget_motion.html'
more_link_pattern_name = 'motion_list' more_link_pattern_name = 'motion_list'
def get_context_data(self, **context): def get_context_data(self, **context):

Some files were not shown because too many files have changed in this diff Show More