@ -13,6 +13,11 @@ Agenda:
|
||||
agenda model. No API changes.
|
||||
Assignments:
|
||||
- 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:
|
||||
- Massive refactoring of the participant app. Now called 'users'.
|
||||
- Used new anonymous user object instead of an authentification backend.
|
||||
|
@ -8,7 +8,7 @@ class AgendaMainMenuEntry(MainMenuEntry):
|
||||
Main menu entry for the agenda app.
|
||||
"""
|
||||
verbose_name = ugettext_lazy('Agenda')
|
||||
required_permission = 'agenda.can_see_agenda'
|
||||
required_permission = 'agenda.can_see'
|
||||
default_weight = 20
|
||||
pattern_name = 'item_overview'
|
||||
icon_css_class = 'glyphicon-calendar'
|
||||
|
@ -114,8 +114,8 @@ class Item(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, MPTTModel):
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
('can_see_agenda', ugettext_noop("Can see agenda")),
|
||||
('can_manage_agenda', ugettext_noop("Can manage agenda")),
|
||||
('can_see', ugettext_noop("Can see agenda")),
|
||||
('can_manage', ugettext_noop("Can manage agenda")),
|
||||
('can_see_orga_items', ugettext_noop("Can see orga items and time scheduling of agenda")))
|
||||
|
||||
class MPTTMeta:
|
||||
|
@ -2,7 +2,7 @@
|
||||
{% load tags %}
|
||||
|
||||
<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">
|
||||
<span style="width: 1px; white-space: nowrap;">
|
||||
{% 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>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<span class="optional-small">
|
||||
<a href="{{ node|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini">
|
||||
<i class="icon-pencil"></i>
|
||||
@ -56,7 +56,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<div class="optional">
|
||||
{% if node.comment %}
|
||||
{{ node.comment|first_line }}
|
||||
|
@ -17,7 +17,7 @@
|
||||
{% block content %}
|
||||
<h1>{% trans "Agenda" %}
|
||||
<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"
|
||||
rel="tooltip" data-original-title="{% trans 'New item' %}">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
@ -31,7 +31,7 @@
|
||||
<span class="optional-small"> {% trans 'Tags' %}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<a href="{% url 'item_csv_import' %}" class="btn btn-default btn-sm"
|
||||
rel="tooltip" data-original-title="{% trans 'Import agenda items' %}">
|
||||
<span class="glyphicon glyphicon-import" aria-hidden="true"></span>
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="pull-left">
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<p>
|
||||
<a href="{% url 'agenda_numbering' %}"
|
||||
class="btn btn-default btn-sm">{% trans 'Number agenda items' %}
|
||||
@ -95,13 +95,13 @@
|
||||
<table id="menu-overview" class="table table-striped table-bordered">
|
||||
<tr>
|
||||
<th class="title">{% trans "Item" %}</th>
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<th class="optional">{% trans "Comment" %}</th>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_see_orga_items %}
|
||||
<th class="duration">{% trans "Duration" %}</th>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
@ -109,13 +109,13 @@
|
||||
<td class="title">
|
||||
{% trans "Agenda" %}
|
||||
</td>
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<td class="optional"></td>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_see_orga_items %}
|
||||
<td class="duration">{{ duration }} h</td>
|
||||
{% 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">
|
||||
{% if perms.core.can_manage_projector %}
|
||||
<span>
|
||||
@ -131,7 +131,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
{% 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 %}
|
||||
<li class="draggable">
|
||||
{% include "agenda/item_row.html" %}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
{% block javascript %}
|
||||
<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.once.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/jquery/jquery.tmpl.js' %}"></script>
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
{% block content %}
|
||||
<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">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{% trans "Do you want to save the changed order of agenda items?" %}<br>
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
<h1>{% trans "Agenda" %}
|
||||
<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' %}">
|
||||
<i class="icon-plus icon-white"></i>
|
||||
{% trans "New" %}
|
||||
@ -45,7 +45,7 @@
|
||||
<span class="optional-small"> {% trans 'Tags' %}</span>
|
||||
</a>
|
||||
{% 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' %}">
|
||||
<i class="icon-import"></i>
|
||||
{% trans "Import" %}
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="pull-left">
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<p><a href="{% url 'agenda_numbering' %}"
|
||||
class="btn btn-mini">{% trans 'Number agenda items' %}</a>
|
||||
</p>
|
||||
@ -96,13 +96,13 @@
|
||||
<table id="menu-overview" class="table table-striped table-bordered">
|
||||
<tr>
|
||||
<th class="title">{% trans "Item" %}</th>
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<th class="optional">{% trans "Comment" %}</th>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_see_orga_items %}
|
||||
<th class="duration">{% trans "Duration" %}</th>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
@ -110,13 +110,13 @@
|
||||
<td class="title">
|
||||
{% trans "Agenda" %}
|
||||
</td>
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<td class="optional"></td>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_see_orga_items %}
|
||||
<td class="duration">{{ duration }} h</td>
|
||||
{% 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">
|
||||
{% if perms.core.can_manage_projector %}
|
||||
<span>
|
||||
@ -132,7 +132,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
{% 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 %}
|
||||
<li class="draggable">
|
||||
{% include "agenda/item_row.html" %}
|
||||
|
@ -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>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<div class="btn-group">
|
||||
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
|
||||
{% trans 'More actions' %}
|
||||
@ -57,7 +57,7 @@
|
||||
</p>
|
||||
|
||||
<!-- Comment -->
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
{% if item.comment %}
|
||||
<h3>{% trans "Comment" %}</h3>
|
||||
<p>{{ item.comment|linebreaks }}</p>
|
||||
@ -67,7 +67,7 @@
|
||||
<!-- List of Speakers -->
|
||||
<h3>{% trans "List of speakers" %} {% if item.speaker_list_closed %}<span class="label label-important">{% trans 'closed' %}</span>{% endif %}</h3>
|
||||
<p>
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
{% if item.speaker_list_closed %}
|
||||
<a href="{% url 'agenda_speaker_reopen' item.pk %}" class="btn btn-mini btn-danger">{% trans 'Open list' %}</a>
|
||||
{% else %}
|
||||
@ -84,7 +84,7 @@
|
||||
{% endif %}
|
||||
</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 %}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{% trans "Do you want to save the changed order of speakers?" %}<br>
|
||||
@ -119,13 +119,13 @@
|
||||
{% endif %}
|
||||
<li id="speaker_{{ speaker_dict.speaker.pk }}">
|
||||
{% 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 }}.
|
||||
{% else %}
|
||||
<small class="grey">[{{ speaker_dict.speaker.begin_time }}{% if speaker_dict.type == 'old_speaker' %} – {{ speaker_dict.speaker.end_time }}{% endif %}]</small>
|
||||
{% endif %}
|
||||
<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' %}
|
||||
<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' %}
|
||||
@ -151,7 +151,7 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<label>{{ field.label }}:</label>
|
||||
|
@ -27,7 +27,7 @@
|
||||
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>
|
||||
</a>
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<a href="{{ item|absolute_url:'update' }}"
|
||||
rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right">
|
||||
<i class="icon-pencil"></i>
|
||||
|
@ -6,7 +6,7 @@
|
||||
{% 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>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<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_end_speach_on_current_list_of_speakers' %}" class="btn btn-mini"><i class="icon icon-bell"></i> {% trans 'End speach' %}</a>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% 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>
|
||||
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
|
||||
<span class="app">{% trans "Agenda" %}</a></span><br>
|
||||
|
@ -50,7 +50,7 @@ class Overview(TemplateView):
|
||||
"""
|
||||
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'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
@ -120,7 +120,7 @@ class Overview(TemplateView):
|
||||
return context
|
||||
|
||||
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(
|
||||
request,
|
||||
_('You are not authorized to manage the agenda.'))
|
||||
@ -179,7 +179,7 @@ class AgendaItemView(SingleObjectMixin, FormView):
|
||||
if self.get_object().type == Item.ORGANIZATIONAL_ITEM:
|
||||
check_permission = request.user.has_perm('agenda.can_see_orga_items')
|
||||
else:
|
||||
check_permission = request.user.has_perm('agenda.can_see_agenda')
|
||||
check_permission = request.user.has_perm('agenda.can_see')
|
||||
return check_permission
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
@ -209,7 +209,7 @@ class SetClosed(SingleObjectMixin, RedirectView):
|
||||
"""
|
||||
Close or open an item.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
allow_ajax = True
|
||||
url_name = 'item_overview'
|
||||
model = Item
|
||||
@ -237,7 +237,7 @@ class ItemUpdate(UpdateView):
|
||||
"""
|
||||
Update an existing item.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
template_name = 'agenda/edit.html'
|
||||
model = Item
|
||||
context_object_name = 'item'
|
||||
@ -256,7 +256,7 @@ class ItemCreate(CreateView):
|
||||
"""
|
||||
Create a new item.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
template_name = 'agenda/edit.html'
|
||||
model = Item
|
||||
context_object_name = 'item'
|
||||
@ -269,7 +269,7 @@ class ItemDelete(DeleteView):
|
||||
"""
|
||||
Delete an item.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
model = Item
|
||||
question_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
|
||||
have to define 'model = ....'
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
url_name = 'item_overview'
|
||||
url_name_args = []
|
||||
|
||||
@ -337,7 +337,7 @@ class CreateRelatedAgendaItemView(SingleObjectMixin, RedirectView):
|
||||
|
||||
|
||||
class AgendaNumberingView(QuestionView):
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
question_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!')
|
||||
@ -356,7 +356,7 @@ class AgendaPDF(PDFView):
|
||||
"""
|
||||
Create a full agenda-PDF.
|
||||
"""
|
||||
required_permission = 'agenda.can_see_agenda'
|
||||
required_permission = 'agenda.can_see'
|
||||
filename = ugettext_lazy('Agenda')
|
||||
document_title = ugettext_lazy('Agenda')
|
||||
|
||||
@ -404,7 +404,7 @@ class SpeakerDeleteView(DeleteView):
|
||||
Check the permission to delete a speaker.
|
||||
"""
|
||||
if 'speaker' in kwargs:
|
||||
return request.user.has_perm('agenda.can_manage_agenda')
|
||||
return request.user.has_perm('agenda.can_manage')
|
||||
else:
|
||||
# Any user who is on the list of speakers can delete himself from the list.
|
||||
return True
|
||||
@ -454,7 +454,7 @@ class SpeakerSpeakView(SingleObjectMixin, RedirectView):
|
||||
"""
|
||||
Mark the speaking user.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
url_name = 'item_view'
|
||||
model = Item
|
||||
|
||||
@ -480,7 +480,7 @@ class SpeakerEndSpeachView(SingleObjectMixin, RedirectView):
|
||||
"""
|
||||
The speach of the actual speaker is finished.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
url_name = 'item_view'
|
||||
model = Item
|
||||
|
||||
@ -505,7 +505,7 @@ class SpeakerListCloseView(SingleObjectMixin, RedirectView):
|
||||
"""
|
||||
View to close and reopen a list of speakers.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
model = Item
|
||||
reopen = False
|
||||
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.
|
||||
"""
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
model = Item
|
||||
url_name = 'item_view'
|
||||
|
||||
@ -657,7 +657,7 @@ class CurrentListOfSpeakersView(RedirectView):
|
||||
else:
|
||||
return reverse('item_view', args=[item.pk])
|
||||
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')
|
||||
else:
|
||||
return reverse('item_view', args=[item.pk])
|
||||
@ -770,7 +770,7 @@ class ItemCSVImportView(CSVImportView):
|
||||
Imports agenda items from an uploaded csv file.
|
||||
"""
|
||||
import_function = staticmethod(import_agenda_items)
|
||||
required_permission = 'agenda.can_manage_agenda'
|
||||
required_permission = 'agenda.can_manage'
|
||||
success_url_name = 'item_overview'
|
||||
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
|
||||
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
|
||||
(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')))):
|
||||
self.permission_denied(request)
|
||||
|
||||
|
@ -46,5 +46,5 @@ class ListOfSpeakersWidget(Widget):
|
||||
icon_css_class = 'icon-bell'
|
||||
|
||||
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'))
|
||||
|
@ -1 +0,0 @@
|
||||
default_app_config = 'openslides.assignment.apps.AssignmentAppConfig'
|
1
openslides/assignments/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
default_app_config = 'openslides.assignments.apps.AssignmentAppConfig'
|
@ -2,8 +2,8 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class AssignmentAppConfig(AppConfig):
|
||||
name = 'openslides.assignment'
|
||||
verbose_name = 'OpenSlides Assignment'
|
||||
name = 'openslides.assignments'
|
||||
verbose_name = 'OpenSlides Assignments'
|
||||
|
||||
def ready(self):
|
||||
# Load main menu entry, personal info and widgets.
|
||||
@ -28,8 +28,8 @@ class AssignmentAppConfig(AppConfig):
|
||||
# Register slides.
|
||||
Assignment = self.get_model('Assignment')
|
||||
AssignmentPoll = self.get_model('AssignmentPoll')
|
||||
register_slide_model(Assignment, 'assignment/slide.html')
|
||||
register_slide_model(AssignmentPoll, 'assignment/assignmentpoll_slide.html')
|
||||
register_slide_model(Assignment, 'assignments/slide.html')
|
||||
register_slide_model(AssignmentPoll, 'assignments/assignmentpoll_slide.html')
|
||||
|
||||
# Register viewsets.
|
||||
router.register('assignment/assignment', AssignmentViewSet)
|
||||
router.register('assignments/assignment', AssignmentViewSet)
|
@ -8,7 +8,7 @@ class AssignmentMainMenuEntry(MainMenuEntry):
|
||||
Main menu entry for the assignment app.
|
||||
"""
|
||||
verbose_name = ugettext_lazy('Elections')
|
||||
required_permission = 'assignment.can_see_assignments'
|
||||
required_permission = 'assignments.can_see'
|
||||
default_weight = 40
|
||||
pattern_name = 'assignment_list'
|
||||
icon_css_class = 'icon-assignment'
|
@ -122,10 +122,10 @@ class Assignment(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
|
||||
|
||||
class Meta:
|
||||
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_self', ugettext_noop('Can nominate oneself')),
|
||||
('can_manage_assignments', ugettext_noop('Can manage elections')),
|
||||
('can_manage', ugettext_noop('Can manage elections')),
|
||||
)
|
||||
ordering = ('title', )
|
||||
verbose_name = ugettext_noop('Election')
|
@ -5,7 +5,7 @@ from .models import Assignment
|
||||
class Index(indexes.SearchIndex, indexes.Indexable):
|
||||
text = indexes.EdgeNgramField(document=True, use_template=True)
|
||||
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):
|
||||
return Assignment
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -36,8 +36,8 @@ angular.module('OpenSlidesApp.assignments', [])
|
||||
|
||||
.factory('Assignment', function(DS) {
|
||||
return DS.defineResource({
|
||||
name: 'assignment/assignment',
|
||||
endpoint: '/rest/assignment/assignment/'
|
||||
name: 'assignments/assignment',
|
||||
endpoint: '/rest/assignments/assignment/'
|
||||
});
|
||||
})
|
||||
|
@ -35,13 +35,13 @@
|
||||
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
|
||||
</a>
|
||||
{% 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">
|
||||
<a data-toggle="dropdown" class="btn btn-default btn-sm dropdown-toggle">
|
||||
<span class="optional-small">{% trans 'More actions' %}</span> <span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
{% if perms.assignment.can_manage_assignments %}
|
||||
{% if perms.assignments.can_manage %}
|
||||
<!-- edit -->
|
||||
<li>
|
||||
<a href="{{ assignment|absolute_url:'update' }}">
|
||||
@ -58,7 +58,7 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
<!-- create agenda item -->
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<li>
|
||||
<a href="{% url 'assignment_create_agenda' assignment.id %}">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
@ -94,7 +94,7 @@
|
||||
{% for person in assignment.candidates %}
|
||||
<li>
|
||||
<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 %}"
|
||||
class="btn btn-default btn-xs"
|
||||
rel="tooltip" data-original-title="{% trans 'Remove candidate' %}">
|
||||
@ -103,7 +103,7 @@
|
||||
{% endif %}
|
||||
{% if person in assignment.elected %}
|
||||
| <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 %}"
|
||||
class="btn btn-default btn-xs"
|
||||
rel="tooltip" data-original-title="{% trans 'Mark candidate as not elected' %}">
|
||||
@ -118,10 +118,10 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% if assignment.phase == assignment.PHASE_SEARCH or perms.assignment.can_manage_assignments and assignment.phase == assignment.PHASE_VOTING %}
|
||||
{% if perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %}
|
||||
{% if assignment.phase == assignment.PHASE_SEARCH or perms.assignments.can_manage and assignment.phase == assignment.PHASE_VOTING %}
|
||||
{% if perms.assignments.can_nominate_self or perms.assignments.can_nominate_other %}
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
{% if perms.assignment.can_nominate_self %}
|
||||
{% if perms.assignments.can_nominate_self %}
|
||||
<p>
|
||||
{% if user_is_candidate %}
|
||||
<a href='{% url 'assignment_del_candidate' assignment.id %}' class="btn btn-default btn-sm">
|
||||
@ -136,7 +136,7 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if perms.assignment.can_nominate_other %}
|
||||
{% if perms.assignments.can_nominate_other %}
|
||||
{% for field in form %}
|
||||
<label>{{ field.label }}:</label>
|
||||
{{ field }}
|
||||
@ -157,7 +157,7 @@
|
||||
{% 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>
|
||||
<ul>
|
||||
{% for person in blocked_candidates %}
|
||||
@ -184,9 +184,9 @@
|
||||
<th>{% trans "Candidates" %}</th>
|
||||
{% for poll in polls %}
|
||||
<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' %}
|
||||
{% 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 %}"
|
||||
href="{% url 'assignmentpoll_publish_poll' poll.id %}"
|
||||
rel="tooltip" data-original-title="{% trans 'Publish result' %}">
|
||||
@ -213,7 +213,7 @@
|
||||
{% endif %}
|
||||
</th>
|
||||
{% 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">
|
||||
<a href="{% url 'assignmentpoll_create' assignment.pk %}" class="btn btn-default btn-sm">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
@ -226,7 +226,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
{% 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 %}"
|
||||
data-original-title="{% trans 'Mark candidate as elected' %}"></a>
|
||||
{% else %}
|
||||
@ -235,7 +235,7 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
{% 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 %}"
|
||||
data-original-title="{% trans 'Mark candidate as elected' %}"></a>
|
||||
{% endif %}
|
||||
@ -257,7 +257,7 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
@ -265,7 +265,7 @@
|
||||
<tr>
|
||||
<td>{% trans 'Valid votes' %}</td>
|
||||
{% 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;">
|
||||
{% if poll.has_votes %}
|
||||
<img src="{% static 'img/voting-yes-grey.png' %}" class="tooltip-left" data-original-title="{% trans 'Valid votes' %}">
|
||||
@ -274,14 +274,14 @@
|
||||
</td>
|
||||
{% endif %}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans 'Invalid votes' %}</td>
|
||||
{% 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;">
|
||||
{% if poll.has_votes %}
|
||||
<img src="{% static 'img/voting-invalid.png' %}" class="tooltip-left" data-original-title="{% trans 'Invalid votes' %}">
|
||||
@ -290,14 +290,14 @@
|
||||
</td>
|
||||
{% endif %}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
<tr class="info total">
|
||||
<td>{% trans 'Votes cast' %}</td>
|
||||
{% 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;">
|
||||
{% if poll.has_votes %}
|
||||
<img src="{% static 'img/voting-total.png' %}" class="tooltip-left" data-original-title="{% trans 'Votes cast' %}">
|
||||
@ -306,14 +306,14 @@
|
||||
</td>
|
||||
{% endif %}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</table>
|
||||
{% else %}
|
||||
<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>
|
||||
<a href='{% url 'assignmentpoll_create' assignment.id %}' class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
@ -335,7 +335,7 @@
|
||||
{{ assignment.posts }}
|
||||
</div> <!--/well-->
|
||||
|
||||
{% if perms.assignment.can_manage_assignments %}
|
||||
{% if perms.assignments.can_manage %}
|
||||
<div class="well">
|
||||
<h4>{% trans "Change phase" %}:</h4>
|
||||
<div class="btn-group btn-group-vertical" data-toggle="buttons-radio">
|
@ -9,7 +9,7 @@
|
||||
{% block content %}
|
||||
<h1>{% trans "Elections" %}
|
||||
<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"
|
||||
rel="tooltip" data-original-title="{% trans 'New election' %}">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
@ -23,7 +23,7 @@
|
||||
<span class="optional-small"> {% trans 'Tags' %}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.assignment.can_see_assignments %}
|
||||
{% if perms.assignments.can_see %}
|
||||
<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">
|
||||
<span class="glyphicon glyphicon-print" aria-hidden="true"></span>
|
||||
@ -39,7 +39,7 @@
|
||||
<th>{% trans "Election" %}</th>
|
||||
<th class="optional">{% trans "Candidates" %}</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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
@ -63,7 +63,7 @@
|
||||
| {% trans "Elected" %}: <span class="badge badge-success">{{ object.elected.count }}</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>
|
||||
<span style="width: 1px; white-space: nowrap;">
|
||||
{% if perms.core.can_manage_projector %}
|
||||
@ -73,7 +73,7 @@
|
||||
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.assignment.can_manage_assignments %}
|
||||
{% if perms.assignments.can_manage %}
|
||||
<a href="{{ object|absolute_url:'update' }}"
|
||||
rel="tooltip" data-original-title="{% trans 'Edit' %}"
|
||||
class="btn btn-default btn-sm">
|
@ -25,7 +25,7 @@
|
||||
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>
|
||||
{% endif %}
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
<a class="btn btn-mini" href="{{ poll|absolute_url:'delete' }}"
|
||||
rel="tooltip" data-original-title="{% trans 'Delete ballot' %}"><i class="icon-remove"></i></a>
|
||||
{% endif %}
|
@ -11,7 +11,7 @@
|
||||
rel="tooltip" data-original-title="{% trans 'Show' %}">
|
||||
<i class="icon-facetime-video {% if assignment.is_active_slide %}icon-white{% endif %}"></i>
|
||||
</a>
|
||||
{% if perms.assignment.can_manage_assignments %}
|
||||
{% if perms.assignments.can_manage %}
|
||||
<a href="{{ assignment|absolute_url:'update' }}"
|
||||
rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right">
|
||||
<i class="icon-pencil"></i>
|
@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load highlight %}
|
||||
|
||||
{% if perms.assignment.can_see_assignments %}
|
||||
{% if perms.assignments.can_see %}
|
||||
<li>
|
||||
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
|
||||
<span class="app">{% trans "Election" %}</a></span><br>
|
@ -30,7 +30,7 @@ class AssignmentListView(ListView):
|
||||
"""
|
||||
Lists all assignments.
|
||||
"""
|
||||
required_permission = 'assignment.can_see_assignments'
|
||||
required_permission = 'assignments.can_see'
|
||||
model = Assignment
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class AssignmentDetail(DetailView):
|
||||
Shows one assignment.
|
||||
"""
|
||||
# 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
|
||||
form_class = AssignmentRunForm
|
||||
|
||||
@ -52,7 +52,7 @@ class AssignmentDetail(DetailView):
|
||||
context['form'] = self.form_class()
|
||||
|
||||
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)
|
||||
vote_results = assignment.vote_results(only_published=True)
|
||||
else:
|
||||
@ -66,15 +66,15 @@ class AssignmentDetail(DetailView):
|
||||
return context
|
||||
|
||||
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()
|
||||
form = self.form_class(self.request.POST)
|
||||
if form.is_valid():
|
||||
user = form.cleaned_data['candidate']
|
||||
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
|
||||
not self.request.user.has_perm('assignment.can_manage_assignments')):
|
||||
not self.request.user.has_perm('assignments.can_manage')):
|
||||
messages.error(
|
||||
self.request,
|
||||
_("User %s does not want to be an candidate") % user)
|
||||
@ -99,25 +99,25 @@ class AssignmentDetail(DetailView):
|
||||
|
||||
|
||||
class AssignmentCreateView(CreateView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = Assignment
|
||||
form_class = AssignmentForm
|
||||
|
||||
|
||||
class AssignmentUpdateView(UpdateView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = Assignment
|
||||
form_class = AssignmentForm
|
||||
|
||||
|
||||
class AssignmentDeleteView(DeleteView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = Assignment
|
||||
success_url_name = 'assignment_list'
|
||||
|
||||
|
||||
class AssignmentSetPhaseView(SingleObjectMixin, RedirectView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = Assignment
|
||||
url_name = 'assignment_detail'
|
||||
|
||||
@ -137,14 +137,14 @@ class AssignmentSetPhaseView(SingleObjectMixin, RedirectView):
|
||||
|
||||
|
||||
class AssignmentCandidateView(SingleObjectMixin, RedirectView):
|
||||
required_permission = 'assignment.can_nominate_self'
|
||||
required_permission = 'assignments.can_nominate_self'
|
||||
model = Assignment
|
||||
url_name = 'assignment_detail'
|
||||
|
||||
def pre_redirect(self, *args, **kwargs):
|
||||
assignment = self.get_object()
|
||||
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
|
||||
if assignment.is_elected(user):
|
||||
messages.error(
|
||||
@ -173,7 +173,7 @@ class AssignmentDeleteCandidateshipView(SingleObjectMixin, RedirectView):
|
||||
def pre_redirect(self, *args, **kwargs):
|
||||
assignment = self.get_object()
|
||||
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
|
||||
assignment.set_blocked(user)
|
||||
messages.success(self.request, _(
|
||||
@ -184,7 +184,7 @@ class AssignmentDeleteCandidateshipView(SingleObjectMixin, RedirectView):
|
||||
|
||||
|
||||
class AssignmentDeleteCandidateshipOtherView(SingleObjectMixin, QuestionView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = Assignment
|
||||
|
||||
def get_question_message(self):
|
||||
@ -227,16 +227,16 @@ class AssignmentViewSet(ModelViewSet):
|
||||
permission to see assignments and in case of create, update or destroy
|
||||
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
|
||||
request.user.has_perm('assignment.can_manage_assignments'))):
|
||||
request.user.has_perm('assignments.can_manage'))):
|
||||
self.permission_denied(request)
|
||||
|
||||
def get_serializer_class(self):
|
||||
"""
|
||||
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
|
||||
else:
|
||||
serializer_class = AssignmentShortSerializer
|
||||
@ -244,7 +244,7 @@ class AssignmentViewSet(ModelViewSet):
|
||||
|
||||
|
||||
class PollCreateView(SingleObjectMixin, RedirectView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = Assignment
|
||||
url_name = 'assignment_detail'
|
||||
|
||||
@ -254,9 +254,9 @@ class PollCreateView(SingleObjectMixin, RedirectView):
|
||||
|
||||
|
||||
class PollUpdateView(PollFormView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
poll_class = AssignmentPoll
|
||||
template_name = 'assignment/assignmentpoll_form.html'
|
||||
template_name = 'assignments/assignmentpoll_form.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(PollUpdateView, self).get_context_data(**kwargs)
|
||||
@ -276,7 +276,7 @@ class PollUpdateView(PollFormView):
|
||||
|
||||
|
||||
class SetPublishPollView(SingleObjectMixin, RedirectView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = AssignmentPoll
|
||||
url_name = 'assignment_detail'
|
||||
allow_ajax = True
|
||||
@ -293,7 +293,7 @@ class SetPublishPollView(SingleObjectMixin, RedirectView):
|
||||
|
||||
|
||||
class SetElectedView(SingleObjectMixin, RedirectView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = Assignment
|
||||
url_name = 'assignment_detail'
|
||||
allow_ajax = True
|
||||
@ -320,7 +320,7 @@ class AssignmentPollDeleteView(DeleteView):
|
||||
"""
|
||||
Delete an assignment poll object.
|
||||
"""
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
model = AssignmentPoll
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
@ -342,7 +342,7 @@ class AssignmentPollDeleteView(DeleteView):
|
||||
|
||||
|
||||
class AssignmentPDF(PDFView):
|
||||
required_permission = 'assignment.can_see_assignments'
|
||||
required_permission = 'assignments.can_see'
|
||||
top_space = 0
|
||||
|
||||
def get_filename(self):
|
||||
@ -539,7 +539,7 @@ class CreateRelatedAgendaItemView(_CreateRelatedAgendaItemView):
|
||||
|
||||
|
||||
class AssignmentPollPDF(PDFView):
|
||||
required_permission = 'assignment.can_manage_assignments'
|
||||
required_permission = 'assignments.can_manage'
|
||||
top_space = 0
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
@ -14,7 +14,7 @@ class AssignmentWidget(Widget):
|
||||
required_permission = 'core.can_manage_projector'
|
||||
default_column = 1
|
||||
default_weight = 50
|
||||
template_name = 'assignment/widget_assignment.html'
|
||||
template_name = 'assignments/widget_assignment.html'
|
||||
more_link_pattern_name = 'assignment_list'
|
||||
|
||||
def get_context_data(self, **context):
|
@ -93,9 +93,9 @@ INSTALLED_APPS = (
|
||||
'openslides.account',
|
||||
'openslides.projector',
|
||||
'openslides.agenda',
|
||||
'openslides.motion',
|
||||
'openslides.assignment',
|
||||
'openslides.mediafile',
|
||||
'openslides.motions',
|
||||
'openslides.assignments',
|
||||
'openslides.mediafiles',
|
||||
'openslides.config',
|
||||
)
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
default_app_config = 'openslides.mediafile.apps.MediafileAppConfig'
|
1
openslides/mediafiles/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
default_app_config = 'openslides.mediafiles.apps.MediafileAppConfig'
|
@ -2,8 +2,8 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class MediafileAppConfig(AppConfig):
|
||||
name = 'openslides.mediafile'
|
||||
verbose_name = 'OpenSlides Mediafile'
|
||||
name = 'openslides.mediafiles'
|
||||
verbose_name = 'OpenSlides Mediafiles'
|
||||
|
||||
def ready(self):
|
||||
# Load main menu entry and widgets.
|
||||
@ -26,4 +26,4 @@ class MediafileAppConfig(AppConfig):
|
||||
register_slide('mediafile', mediafile_presentation_as_slide, Mediafile)
|
||||
|
||||
# Register viewsets.
|
||||
router.register('mediafile/mediafile', MediafileViewSet)
|
||||
router.register('mediafiles/mediafile', MediafileViewSet)
|
@ -14,6 +14,6 @@ class MediafileMainMenuEntry(MainMenuEntry):
|
||||
|
||||
def check_permission(self):
|
||||
return (
|
||||
self.request.user.has_perm('mediafile.can_see') or
|
||||
self.request.user.has_perm('mediafile.can_upload') or
|
||||
self.request.user.has_perm('mediafile.can_manage'))
|
||||
self.request.user.has_perm('mediafiles.can_see') or
|
||||
self.request.user.has_perm('mediafiles.can_upload') or
|
||||
self.request.user.has_perm('mediafiles.can_manage'))
|
@ -5,7 +5,7 @@ from .models import Mediafile
|
||||
class Index(indexes.SearchIndex, indexes.Indexable):
|
||||
text = indexes.EdgeNgramField(document=True, use_template=True)
|
||||
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):
|
||||
return Mediafile
|
@ -26,4 +26,4 @@ def mediafile_presentation_as_slide(**kwargs):
|
||||
raise SlideError
|
||||
context = {'pdf': pdf, 'page_num': page_num,
|
||||
'fullscreen': config['pdf_fullscreen']}
|
||||
return render_to_string('mediafile/presentation_slide.html', context)
|
||||
return render_to_string('mediafiles/presentation_slide.html', context)
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -8,7 +8,7 @@
|
||||
{% block content %}
|
||||
<h1>{% trans 'Files' %}
|
||||
<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>
|
||||
{% endif %}
|
||||
</small>
|
||||
@ -20,7 +20,7 @@
|
||||
<th class="optional-small">{% trans 'Size' %}</th>
|
||||
<th class="optional">{% trans 'Upload time' %}</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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
@ -31,13 +31,13 @@
|
||||
<td class="optional-small">{{ mediafile.get_filesize }}</td>
|
||||
<td class="optional">{{ mediafile.timestamp }}</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>
|
||||
{% if mediafile.with_action_buttons %}
|
||||
<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:'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' %}">
|
||||
<i class="icon-facetime-video {% if mediafile.is_active_slide %}icon-white{% endif %}">
|
||||
</i>
|
@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load highlight %}
|
||||
|
||||
{% if perms.mediafile.can_see %}
|
||||
{% if perms.mediafiles.can_see %}
|
||||
<li>
|
||||
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
|
||||
<span class="app">{% trans "File" %}</a></span><br>
|
@ -18,16 +18,16 @@ class MediafileListView(ListView):
|
||||
model = Mediafile
|
||||
|
||||
def check_permission(self, request, *args, **kwargs):
|
||||
return (request.user.has_perm('mediafile.can_see') or
|
||||
request.user.has_perm('mediafile.can_upload') or
|
||||
request.user.has_perm('mediafile.can_manage'))
|
||||
return (request.user.has_perm('mediafiles.can_see') or
|
||||
request.user.has_perm('mediafiles.can_upload') or
|
||||
request.user.has_perm('mediafiles.can_manage'))
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(MediafileListView, self).get_context_data(*args, **kwargs)
|
||||
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
|
||||
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
|
||||
else:
|
||||
mediafile.with_action_buttons = False
|
||||
@ -47,7 +47,7 @@ class MediafileViewMixin(object):
|
||||
|
||||
def get_form(self, form_class):
|
||||
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)
|
||||
else:
|
||||
return MediafileManagerForm(**form_kwargs)
|
||||
@ -58,7 +58,7 @@ class MediafileViewMixin(object):
|
||||
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.
|
||||
"""
|
||||
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
|
||||
return super(MediafileViewMixin, self).manipulate_object(*args, **kwargs)
|
||||
|
||||
@ -67,7 +67,7 @@ class MediafileCreateView(MediafileViewMixin, CreateView):
|
||||
"""
|
||||
View to upload a new file.
|
||||
"""
|
||||
required_permission = 'mediafile.can_upload'
|
||||
required_permission = 'mediafiles.can_upload'
|
||||
|
||||
def get_form_kwargs(self, *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.
|
||||
"""
|
||||
def check_permission(self, request, *args, **kwargs):
|
||||
return (request.user.has_perm('mediafile.can_manage') or
|
||||
(request.user.has_perm('mediafile.can_upload') and
|
||||
return (request.user.has_perm('mediafiles.can_manage') or
|
||||
(request.user.has_perm('mediafiles.can_upload') and
|
||||
self.get_object().uploader == self.request.user))
|
||||
|
||||
def get_form_kwargs(self, *args, **kwargs):
|
||||
@ -99,8 +99,8 @@ class MediafileDeleteView(DeleteView):
|
||||
success_url_name = 'mediafile_list'
|
||||
|
||||
def check_permission(self, request, *args, **kwargs):
|
||||
return (request.user.has_perm('mediafile.can_manage') or
|
||||
(request.user.has_perm('mediafile.can_upload') and self.get_object().uploader == self.request.user))
|
||||
return (request.user.has_perm('mediafiles.can_manage') or
|
||||
(request.user.has_perm('mediafiles.can_upload') and self.get_object().uploader == self.request.user))
|
||||
|
||||
def on_clicked_yes(self, *args, **kwargs):
|
||||
"""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
|
||||
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.
|
||||
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
|
||||
request.user.has_perm('mediafile.can_manage'))):
|
||||
request.user.has_perm('mediafiles.can_manage'))):
|
||||
self.permission_denied(request)
|
@ -15,7 +15,7 @@ class PDFPresentationWidget(Widget):
|
||||
required_permission = 'core.can_manage_projector'
|
||||
default_column = 1
|
||||
default_weight = 75
|
||||
template_name = 'mediafile/widget_pdfpresentation.html'
|
||||
template_name = 'mediafiles/widget_pdfpresentation.html'
|
||||
icon_css_class = 'icon-align-left'
|
||||
more_link_pattern_name = 'mediafile_list'
|
||||
# javascript_files = None # TODO: Add pdf.js stuff here.
|
@ -1 +0,0 @@
|
||||
default_app_config = 'openslides.motion.apps.MotionAppConfig'
|
1
openslides/motions/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
default_app_config = 'openslides.motions.apps.MotionAppConfig'
|
@ -3,7 +3,7 @@ from django.db.models.signals import post_migrate
|
||||
|
||||
|
||||
class MotionAppConfig(AppConfig):
|
||||
name = 'openslides.motion'
|
||||
name = 'openslides.motions'
|
||||
verbose_name = 'OpenSlides Motion'
|
||||
|
||||
def ready(self):
|
||||
@ -25,10 +25,10 @@ class MotionAppConfig(AppConfig):
|
||||
# Register slides.
|
||||
Motion = self.get_model('Motion')
|
||||
MotionPoll = self.get_model('MotionPoll')
|
||||
register_slide_model(Motion, 'motion/slide.html')
|
||||
register_slide_model(MotionPoll, 'motion/motionpoll_slide.html')
|
||||
register_slide_model(Motion, 'motions/slide.html')
|
||||
register_slide_model(MotionPoll, 'motions/motionpoll_slide.html')
|
||||
|
||||
# Register viewsets.
|
||||
router.register('motion/category', CategoryViewSet)
|
||||
router.register('motion/motion', MotionViewSet)
|
||||
router.register('motion/workflow', WorkflowViewSet)
|
||||
router.register('motions/category', CategoryViewSet)
|
||||
router.register('motions/motion', MotionViewSet)
|
||||
router.register('motions/workflow', WorkflowViewSet)
|
@ -3,7 +3,7 @@ import collections
|
||||
from django import forms
|
||||
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,
|
||||
CSVImportForm, LocalizedModelChoiceField)
|
||||
from openslides.users.models import User
|
@ -8,7 +8,7 @@ class MotionMainMenuEntry(MainMenuEntry):
|
||||
Main menu entry for the motion app.
|
||||
"""
|
||||
verbose_name = ugettext_lazy('Motions')
|
||||
required_permission = 'motion.can_see_motion'
|
||||
required_permission = 'motions.can_see'
|
||||
default_weight = 30
|
||||
pattern_name = 'motion_list'
|
||||
icon_css_class = 'glyphicon-file'
|
@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||
|
||||
from openslides.config.api import config
|
||||
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.projector.models import SlideMixin
|
||||
from jsonfield import JSONField
|
||||
@ -85,10 +85,10 @@ class Motion(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
('can_see_motion', ugettext_noop('Can see motions')),
|
||||
('can_create_motion', ugettext_noop('Can create motions')),
|
||||
('can_support_motion', ugettext_noop('Can support motions')),
|
||||
('can_manage_motion', ugettext_noop('Can manage motions')),
|
||||
('can_see', ugettext_noop('Can see motions')),
|
||||
('can_create', ugettext_noop('Can create motions')),
|
||||
('can_support', ugettext_noop('Can support motions')),
|
||||
('can_manage', ugettext_noop('Can manage motions')),
|
||||
)
|
||||
ordering = ('identifier', )
|
||||
verbose_name = ugettext_noop('Motion')
|
||||
@ -505,18 +505,18 @@ class Motion(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
|
||||
* reset_state
|
||||
"""
|
||||
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
|
||||
person.has_perm(self.state.required_permission_to_see) or
|
||||
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.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),
|
||||
|
||||
'support': (self.state.allow_support and
|
||||
@ -527,9 +527,9 @@ class Motion(RESTModelMixin, SlideMixin, AbsoluteUrlMixin, models.Model):
|
||||
'unsupport': (self.state.allow_support and
|
||||
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']
|
||||
|
||||
@ -855,7 +855,7 @@ class State(RESTModelMixin, models.Model):
|
||||
|
||||
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
|
||||
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)
|
@ -5,7 +5,7 @@ from .models import Motion
|
||||
class Index(indexes.SearchIndex, indexes.Indexable):
|
||||
text = indexes.EdgeNgramField(document=True, use_template=True)
|
||||
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):
|
||||
return Motion
|
@ -9,7 +9,7 @@
|
||||
<h1>
|
||||
{% trans "Categories" %}
|
||||
<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>
|
||||
{% endif %}
|
||||
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
|
@ -51,7 +51,7 @@
|
||||
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
|
||||
</a>
|
||||
{% 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">
|
||||
<a data-toggle="dropdown" class="btn btn-sm btn-default dropdown-toggle">
|
||||
<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>
|
||||
{% trans 'Edit motion' %}</a></li>
|
||||
{% endif %}
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
<!-- delete -->
|
||||
{% if allowed_actions.delete %}
|
||||
<li><a href="{{ motion|absolute_url:'delete' }}">
|
||||
@ -72,7 +72,7 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- create agenda item -->
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage %}
|
||||
<li><a href="{% url 'motion_create_agenda' motion.id %}">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
{% trans 'New agenda item' %}</a></li>
|
||||
@ -142,7 +142,7 @@
|
||||
{% if version == motion.active_version %}
|
||||
<span class="badge badge-success" title="{% trans 'This version is authorized' %}"><i class="icon-ok icon-white"></i></span>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@ -157,7 +157,7 @@
|
||||
<a href="{{ version|absolute_url }}" title="{% trans 'Show' %}" class="btn btn-default btn-xs">
|
||||
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
|
||||
</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">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
||||
</a>
|
||||
@ -173,7 +173,7 @@
|
||||
{% endwith %}
|
||||
|
||||
<!-- Log -->
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
<p>
|
||||
<div class="btn-group" data-toggle="buttons-checkbox">
|
||||
<button type="button" class="btn btn-default btn-sm" data-toggle="collapse" data-target="#log">
|
||||
@ -227,7 +227,7 @@
|
||||
{% if polls.count > 1 %}
|
||||
{{ poll.poll_number|ordinal|safe }} {% trans "vote" %}:
|
||||
{% endif %}
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
{% if polls.count > 1 %}<br>{% endif %}
|
||||
<a class="btn btn-default btn-sm activate_link {% if poll.is_active_slide %}btn-primary{% endif %}"
|
||||
href="{{ poll|absolute_url:'projector' }}"
|
||||
@ -326,7 +326,7 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- 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 %}
|
||||
<br><br>
|
||||
<a href="{% url 'motion_unsupport' motion.id %}" class="btn btn-default btn-sm">
|
||||
@ -348,7 +348,7 @@
|
||||
{% endif %}
|
||||
</div> <!--/well-->
|
||||
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
<!-- Manage motion box -->
|
||||
<div class="well">
|
||||
<h4>{% trans "Manage motion" %}</h4>
|
@ -25,8 +25,8 @@
|
||||
<h1>
|
||||
{% trans "Motions" %}
|
||||
<small class="pull-right">
|
||||
{% if perms.motion.can_create_motion %}
|
||||
{% if not 'motion_stop_submitting'|get_config or perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_create %}
|
||||
{% if not 'motion_stop_submitting'|get_config or perms.motions.can_manage %}
|
||||
<a href="{% url 'motion_create' %}" class="btn btn-sm btn-primary"
|
||||
rel="tooltip" data-original-title="{% trans 'New motion' %}">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
@ -41,7 +41,7 @@
|
||||
<span class="optional-small"> {% trans 'Tags' %}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
<a href="{% url 'motion_category_list' %}" class="btn btn-default btn-sm"
|
||||
rel="tooltip" data-original-title="{% trans 'Manage categories' %}">
|
||||
<span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>
|
||||
@ -71,7 +71,7 @@
|
||||
<th class="optional">{% trans "Supporters" %}</th>
|
||||
{% endif %}
|
||||
<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>
|
||||
{% endif %}
|
||||
</tr>
|
||||
@ -120,7 +120,7 @@
|
||||
<i class="icon-warning-sign icon-white"></i>
|
||||
</a>
|
||||
{% 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>
|
||||
<span style="width: 1px; white-space: nowrap;">
|
||||
{% if perms.core.can_manage_projector %}
|
||||
@ -130,7 +130,7 @@
|
||||
<span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span>
|
||||
</a>
|
||||
{% 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' %}"
|
||||
class="btn btn-default btn-sm">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
|
@ -26,7 +26,7 @@
|
||||
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>
|
||||
{% endif %}
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
<a class="btn btn-mini" href="{{ poll|absolute_url:'delete' }}"
|
||||
rel="tooltip" data-original-title="{% trans 'Delete Vote' %}"><i class="icon-remove"></i></a>
|
||||
{% endif %}
|
@ -11,7 +11,7 @@
|
||||
rel="tooltip" data-original-title="{% trans 'Show' %}">
|
||||
<i class="icon-facetime-video {% if motion.is_active_slide %}icon-white{% endif %}"></i>
|
||||
</a>
|
||||
{% if perms.motion.can_manage_motion %}
|
||||
{% if perms.motions.can_manage %}
|
||||
<a href="{{ motion|absolute_url:'update' }}"
|
||||
rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini right">
|
||||
<i class="icon-pencil"></i>
|
@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load highlight %}
|
||||
|
||||
{% if perms.motion.can_see_motion %}
|
||||
{% if perms.motions.can_see %}
|
||||
<li>
|
||||
<a href="{{ result.object.get_absolute_url }}">{{ result.object }}</a><br>
|
||||
<span class="app">{% trans "Motion" %}</a></span><br>
|
@ -2,9 +2,8 @@ from django.conf.urls import patterns, url
|
||||
|
||||
from . import views
|
||||
|
||||
# TODO: define the Views inhere
|
||||
urlpatterns = patterns(
|
||||
'openslides.motion.views',
|
||||
'',
|
||||
url(r'^$',
|
||||
views.MotionListView.as_view(),
|
||||
name='motion_list'),
|
@ -32,11 +32,12 @@ class MotionListView(ListView):
|
||||
View, to list all motions.
|
||||
"""
|
||||
model = Motion
|
||||
required_permission = 'motion.can_see_motion'
|
||||
required_permission = 'motions.can_see'
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
@ -156,13 +157,13 @@ class MotionEditMixin(object):
|
||||
"""
|
||||
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)):
|
||||
form_classes.append(MotionIdentifierMixin)
|
||||
|
||||
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(MotionCategoryMixin)
|
||||
if config['motion_min_supporters'] > 0:
|
||||
@ -185,13 +186,13 @@ class MotionCreateView(MotionEditMixin, CreateView):
|
||||
def check_permission(self, request, *args, **kwargs):
|
||||
"""
|
||||
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
|
||||
'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'):
|
||||
return not config['motion_stop_submitting'] or request.user.has_perm('motion.can_manage_motion')
|
||||
if request.user.has_perm('motions.can_create'):
|
||||
return not config['motion_stop_submitting'] or request.user.has_perm('motions.can_manage')
|
||||
return False
|
||||
|
||||
def form_valid(self, form):
|
||||
@ -216,7 +217,7 @@ class MotionCreateView(MotionEditMixin, CreateView):
|
||||
"""
|
||||
initial = super().get_initial()
|
||||
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']
|
||||
return initial
|
||||
|
||||
@ -297,7 +298,7 @@ class MotionUpdateView(MotionEditMixin, UpdateView):
|
||||
response = super().form_valid(form)
|
||||
self.write_log()
|
||||
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.write_log([ugettext_noop('All supporters removed')], self.request.user)
|
||||
return response
|
||||
@ -320,7 +321,7 @@ class MotionUpdateView(MotionEditMixin, UpdateView):
|
||||
|
||||
def get_initial(self):
|
||||
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
|
||||
return initial
|
||||
|
||||
@ -366,7 +367,7 @@ class VersionDeleteView(DeleteView):
|
||||
View to delete a motion version.
|
||||
"""
|
||||
model = MotionVersion
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
success_url_name = 'motion_detail'
|
||||
|
||||
def get_object(self):
|
||||
@ -398,7 +399,7 @@ class VersionPermitView(SingleObjectMixin, QuestionView):
|
||||
"""
|
||||
model = Motion
|
||||
final_message = ugettext_lazy('Version successfully permitted.')
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
question_url_name = 'motion_version_detail'
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
@ -442,7 +443,7 @@ class VersionDiffView(DetailView):
|
||||
Show diff between two versions of a motion.
|
||||
"""
|
||||
model = Motion
|
||||
template_name = 'motion/motion_diff.html'
|
||||
template_name = 'motions/motion_diff.html'
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
required_permission = 'motion.can_support_motion'
|
||||
required_permission = 'motions.can_support'
|
||||
model = Motion
|
||||
support = True
|
||||
|
||||
@ -552,12 +553,12 @@ class MotionViewSet(ModelViewSet):
|
||||
permission to see motions and in case of create, update or
|
||||
destroy requests the permission to manage motions.
|
||||
"""
|
||||
# TODO: Use motion.can_create_motion permission and
|
||||
# motion.can_support_motion permission to create and update some
|
||||
# TODO: Use motions.can_create permission and
|
||||
# motions.can_support permission to create and update some
|
||||
# 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
|
||||
request.user.has_perm('motion.can_manage_motion'))):
|
||||
request.user.has_perm('motions.can_manage'))):
|
||||
self.permission_denied(request)
|
||||
|
||||
|
||||
@ -565,7 +566,7 @@ class PollCreateView(SingleObjectMixin, RedirectView):
|
||||
"""
|
||||
View to create a poll for a motion.
|
||||
"""
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
model = Motion
|
||||
url_name = 'motionpoll_detail'
|
||||
|
||||
@ -589,7 +590,7 @@ class PollMixin(object):
|
||||
Mixin for the PollUpdateView and the PollDeleteView.
|
||||
"""
|
||||
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
success_url_name = 'motion_detail'
|
||||
|
||||
def get_object(self):
|
||||
@ -626,7 +627,7 @@ class PollUpdateView(PollMixin, PollFormView):
|
||||
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):
|
||||
"""
|
||||
@ -675,7 +676,7 @@ class PollPDFView(PollMixin, PDFView):
|
||||
Generates a ballotpaper.
|
||||
"""
|
||||
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
top_space = 0
|
||||
|
||||
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 True, the default state is taken.
|
||||
"""
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
url_name = 'motion_detail'
|
||||
model = Motion
|
||||
reset = False
|
||||
@ -769,7 +770,7 @@ class MotionPDFView(SingleObjectMixin, PDFView):
|
||||
PDF.
|
||||
"""
|
||||
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:
|
||||
is_allowed = self.get_object().get_allowed_actions(request.user)['see']
|
||||
return is_allowed
|
||||
@ -811,13 +812,13 @@ class MotionPDFView(SingleObjectMixin, PDFView):
|
||||
|
||||
|
||||
class CategoryListView(ListView):
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
model = Category
|
||||
|
||||
|
||||
class CategoryCreateView(CreateView):
|
||||
fields = ("name", "prefix",)
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
model = Category
|
||||
success_url_name = 'motion_category_list'
|
||||
url_name_args = []
|
||||
@ -825,14 +826,14 @@ class CategoryCreateView(CreateView):
|
||||
|
||||
class CategoryUpdateView(UpdateView):
|
||||
fields = ("name", "prefix",)
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
model = Category
|
||||
success_url_name = 'motion_category_list'
|
||||
url_name_args = []
|
||||
|
||||
|
||||
class CategoryDeleteView(DeleteView):
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
model = Category
|
||||
question_url_name = 'motion_category_list'
|
||||
url_name_args = []
|
||||
@ -852,9 +853,9 @@ class CategoryViewSet(ModelViewSet):
|
||||
permission to see motions and in case of create, update or destroy
|
||||
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
|
||||
request.user.has_perm('motion.can_manage_motion'))):
|
||||
request.user.has_perm('motions.can_manage'))):
|
||||
self.permission_denied(request)
|
||||
|
||||
|
||||
@ -863,9 +864,9 @@ class MotionCSVImportView(CSVImportView):
|
||||
Imports motions from an uploaded csv file.
|
||||
"""
|
||||
form_class = MotionCSVImportForm
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
required_permission = 'motions.can_manage'
|
||||
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):
|
||||
"""
|
||||
@ -897,7 +898,7 @@ class WorkflowViewSet(ModelViewSet):
|
||||
permission to see motions and in case of create, update or destroy
|
||||
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
|
||||
request.user.has_perm('motion.can_manage_motion'))):
|
||||
request.user.has_perm('motions.can_manage'))):
|
||||
self.permission_denied(request)
|
@ -15,7 +15,7 @@ class MotionWidget(Widget):
|
||||
default_column = 1
|
||||
default_weight = 40
|
||||
icon_css_class = 'icon-file'
|
||||
template_name = 'motion/widget_motion.html'
|
||||
template_name = 'motions/widget_motion.html'
|
||||
more_link_pattern_name = 'motion_list'
|
||||
|
||||
def get_context_data(self, **context):
|