Added can_view_vouchers permission

This commit is contained in:
Raphael Michel
2016-09-24 16:57:41 +02:00
parent 9f934858cc
commit f8c99f6d02
7 changed files with 45 additions and 6 deletions

View File

@@ -87,7 +87,7 @@
</a>
</li>
{% endif %}
{% if request.eventperm.can_change_vouchers %}
{% if request.eventperm.can_view_vouchers %}
<li>
<a href="{% url 'control:event.vouchers' organizer=request.event.organizer.slug event=request.event.slug %}"
{% if url_name == "event.vouchers" %}class="active"{% endif %}>

View File

@@ -18,6 +18,7 @@
<th>{% trans "View orders" %}</th>
<th>{% trans "Change orders" %}</th>
<th>{% trans "Change permissions" %}</th>
<th>{% trans "View vouchers" %}</th>
<th>{% trans "Change vouchers" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
@@ -31,6 +32,7 @@
<td>{{ form.can_view_orders }}</td>
<td>{{ form.can_change_orders }}</td>
<td>{{ form.can_change_permissions }}</td>
<td>{{ form.can_view_vouchers }}</td>
<td>{{ form.can_change_vouchers }}</td>
<td>{{ form.DELETE }}</td>
</tr>
@@ -49,6 +51,7 @@
<td>{{ add_form.can_change_orders }}</td>
<td>{{ add_form.can_change_permissions }}</td>
<td>{{ add_form.can_change_vouchers }}</td>
<td>{{ add_form.can_view_vouchers }}</td>
</tr>
</tbody>
</table>

View File

@@ -445,7 +445,7 @@ class EventPermissionForm(I18nModelForm):
model = EventPermission
fields = (
'can_change_settings', 'can_change_items', 'can_change_permissions', 'can_view_orders',
'can_change_orders', 'can_change_vouchers'
'can_change_orders', 'can_view_vouchers', 'can_change_vouchers'
)

View File

@@ -28,7 +28,7 @@ class VoucherList(EventPermissionRequiredMixin, ListView):
context_object_name = 'vouchers'
paginate_by = 30
template_name = 'pretixcontrol/vouchers/index.html'
permission = 'can_change_vouchers'
permission = 'can_view_vouchers'
def get_queryset(self):
qs = self.request.event.vouchers.all().select_related('item', 'variation')
@@ -90,7 +90,7 @@ class VoucherList(EventPermissionRequiredMixin, ListView):
class VoucherTags(EventPermissionRequiredMixin, TemplateView):
template_name = 'pretixcontrol/vouchers/tags.html'
permission = 'can_change_vouchers'
permission = 'can_view_vouchers'
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)