ADD: dav_events: add support for confirm payments.
This commit is contained in:
1
TODO.txt
1
TODO.txt
@@ -1,3 +1,4 @@
|
|||||||
|
- FIX: timestamp of automagically detected expire status
|
||||||
- FIX: validation for first_day
|
- FIX: validation for first_day
|
||||||
|
|
||||||
- Test event list export
|
- Test event list export
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ DEFAULT_SETTINGS = (
|
|||||||
DefaultSetting('groups_publisher_print', []),
|
DefaultSetting('groups_publisher_print', []),
|
||||||
DefaultSetting('groups_publisher_web', []),
|
DefaultSetting('groups_publisher_web', []),
|
||||||
DefaultSetting('groups_publisher_facebook', []),
|
DefaultSetting('groups_publisher_facebook', []),
|
||||||
|
DefaultSetting('groups_office', []),
|
||||||
DefaultSetting('forms_development_init', False),
|
DefaultSetting('forms_development_init', False),
|
||||||
DefaultSetting('form_initials', dict()),
|
DefaultSetting('form_initials', dict()),
|
||||||
DefaultSetting('matrix_config', ImproperlyConfigured),
|
DefaultSetting('matrix_config', ImproperlyConfigured),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ GROUPS_MANAGER_B = ['Bereichsleiter_Bergsteigen']
|
|||||||
GROUPS_PUBLISHER_PRINT = ['Redaktion_KA-Alpin']
|
GROUPS_PUBLISHER_PRINT = ['Redaktion_KA-Alpin']
|
||||||
GROUPS_PUBLISHER_WEB = ['Redaktion_Joomla']
|
GROUPS_PUBLISHER_WEB = ['Redaktion_Joomla']
|
||||||
GROUPS_PUBLISHER_FACEBOOK = ['Redaktion_Facebook']
|
GROUPS_PUBLISHER_FACEBOOK = ['Redaktion_Facebook']
|
||||||
|
GROUPS_OFFICE = ['Geschaeftsstelle']
|
||||||
|
|
||||||
# ChainedForm and sub classes
|
# ChainedForm and sub classes
|
||||||
FORM_INITIALS = {
|
FORM_INITIALS = {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
<div class="action-tabs top-most">
|
<div class="action-tabs top-most">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{% if has_permission_submit %}
|
{% if has_permission_submit %}
|
||||||
<a id="btn-submit" class="btn {% if not is_submitted %}btn-success{% else %}btn-default disabled{% endif %}"
|
<a id="btn-submit" class="btn btn-sm {% if not is_submitted %}btn-success{% else %}btn-default disabled{% endif %}"
|
||||||
data-toggle="modal" data-target="#modal-submit-dialog">
|
data-toggle="modal" data-target="#modal-submit-dialog">
|
||||||
{% if is_submitted %}
|
{% if is_submitted %}
|
||||||
{% bootstrap_icon 'check' %} 
|
{% bootstrap_icon 'check' %} 
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if has_permission_accept %}
|
{% if has_permission_accept %}
|
||||||
<a id="btn-accept" class="btn {% if is_submitted and not is_accepted %}btn-success{% else %}btn-default disabled{% endif %}"
|
<a id="btn-accept" class="btn btn-sm {% if is_submitted and not is_accepted %}btn-success{% else %}btn-default disabled{% endif %}"
|
||||||
data-toggle="modal" data-target="#modal-accept-dialog">
|
data-toggle="modal" data-target="#modal-accept-dialog">
|
||||||
{% if is_accepted %}
|
{% if is_accepted %}
|
||||||
{% bootstrap_icon 'check' %} 
|
{% bootstrap_icon 'check' %} 
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if has_permission_publish %}
|
{% if has_permission_publish %}
|
||||||
<a id="btn-confirmpublication" class="btn {% if is_accepted and not is_publishing and not is_published %}btn-success{% else %}btn-default disabled{% endif %}"
|
<a id="btn-confirmpublication" class="btn btn-sm {% if is_accepted and not is_publishing and not is_published %}btn-success{% else %}btn-default disabled{% endif %}"
|
||||||
data-toggle="modal" data-target="#modal-confirmpublication-dialog">
|
data-toggle="modal" data-target="#modal-confirmpublication-dialog">
|
||||||
{% if is_publishing_any %}
|
{% if is_publishing_any %}
|
||||||
{% bootstrap_icon 'check' %} 
|
{% bootstrap_icon 'check' %} 
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
{% trans 'Veröffentlichung bestätigen' %}
|
{% trans 'Veröffentlichung bestätigen' %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a id="btn-clone" class="btn btn-primary"
|
<a id="btn-clone" class="btn btn-sm btn-primary"
|
||||||
href="{% url 'dav_events:create' %}?copy={{ event.pk }}"
|
href="{% url 'dav_events:create' %}?copy={{ event.pk }}"
|
||||||
title="{% trans 'Diese Veranstaltung als Vorlage für eine neue Veranstaltung benutzen' %}">
|
title="{% trans 'Diese Veranstaltung als Vorlage für eine neue Veranstaltung benutzen' %}">
|
||||||
{% bootstrap_icon 'duplicate' %} 
|
{% bootstrap_icon 'duplicate' %} 
|
||||||
@@ -165,10 +165,12 @@
|
|||||||
<a class="btn {% if has_permission_update %}btn-warning{% else %}disabled{% endif %}"
|
<a class="btn {% if has_permission_update %}btn-warning{% else %}disabled{% endif %}"
|
||||||
href="{% url 'dav_events:update' event.pk %}">{% trans 'Ändern' %}</a>
|
href="{% url 'dav_events:update' event.pk %}">{% trans 'Ändern' %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="{% if not event.registration_required %}disabled{% endif %}">
|
{% if event.registration_required %}
|
||||||
<a class="btn {% if not event.registration_required %}disabled{% elif is_published_any %}btn-warning{% endif %}"
|
<li>
|
||||||
|
<a class="btn {% if is_published_any %}btn-success{% endif %}"
|
||||||
href="{% url 'dav_events:registrations' event.pk %}">{% trans 'Anmeldungen' %}</a>
|
href="{% url 'dav_events:registrations' event.pk %}">{% trans 'Anmeldungen' %}</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{% render_event_status event show_void=False %}
|
{% render_event_status event %}
|
||||||
</div>
|
</div>
|
||||||
<h3 class="panel-title">{{ event }}</h3>
|
<h3 class="panel-title">{{ event }}</h3>
|
||||||
</div>
|
</div>
|
||||||
@@ -196,6 +196,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if has_permission_update_registration %}
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
{% if event.is_deadline_expired %}
|
{% if event.is_deadline_expired %}
|
||||||
<a id="btn-kill-deadline" class="btn btn-danger"
|
<a id="btn-kill-deadline" class="btn btn-danger"
|
||||||
@@ -217,6 +218,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -241,6 +243,7 @@
|
|||||||
<form action="" method="post" class="form-inline">
|
<form action="" method="post" class="form-inline">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="registration" value="{{ registration.id }}">
|
<input type="hidden" name="registration" value="{{ registration.id }}">
|
||||||
|
{% if has_permission_update_participants %}
|
||||||
<button type="submit" name="action" value="accept_registration"
|
<button type="submit" name="action" value="accept_registration"
|
||||||
class="btn btn-link no-padding" title="zur Teilnehmerliste hinzufügen">
|
class="btn btn-link no-padding" title="zur Teilnehmerliste hinzufügen">
|
||||||
<span class="text-success">{% bootstrap_icon 'plus-sign' %}</span>
|
<span class="text-success">{% bootstrap_icon 'plus-sign' %}</span>
|
||||||
@@ -251,6 +254,7 @@
|
|||||||
<span class="text-danger">{% bootstrap_icon 'minus-sign' %}</span>
|
<span class="text-danger">{% bootstrap_icon 'minus-sign' %}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% if registration.answered %}
|
{% if registration.answered %}
|
||||||
<span class="text-muted">
|
<span class="text-muted">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -277,6 +281,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if has_permission_update_participants %}
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info">
|
||||||
<div id="headingAddParticipant" class="panel-heading" role="tab">
|
<div id="headingAddParticipant" class="panel-heading" role="tab">
|
||||||
<h5 class="panel-title">
|
<h5 class="panel-title">
|
||||||
@@ -302,6 +307,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if participants %}
|
{% if participants %}
|
||||||
{% for form in participant_formset %}
|
{% for form in participant_formset %}
|
||||||
{% with participant=form.instance %}
|
{% with participant=form.instance %}
|
||||||
@@ -322,6 +328,7 @@
|
|||||||
<form action="" method="post" class="form-inline">
|
<form action="" method="post" class="form-inline">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="id" value="{{ participant.id }}">
|
<input type="hidden" name="id" value="{{ participant.id }}">
|
||||||
|
{% if has_permission_update_participants %}
|
||||||
<button name="action" value="moveup_participant"
|
<button name="action" value="moveup_participant"
|
||||||
title="{% trans 'Nach oben verschieben' %}"
|
title="{% trans 'Nach oben verschieben' %}"
|
||||||
class="btn btn-link no-padding {% if forloop.first %}invisible{% endif %}">
|
class="btn btn-link no-padding {% if forloop.first %}invisible{% endif %}">
|
||||||
@@ -339,16 +346,29 @@
|
|||||||
<span class="text-danger">{% bootstrap_icon 'remove-circle' %}</span>
|
<span class="text-danger">{% bootstrap_icon 'remove-circle' %}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{% if event.charge and participant.paid %}
|
{% endif %}
|
||||||
<span class="text-success" title="Geldeingang bestätigt">
|
{% if event.charge and participant.paid and has_permission_payment %}
|
||||||
|
<button name="action" value="revoke_payment"
|
||||||
|
title="{% trans 'Geldeingang wurde bestätigt' %} - {% trans 'Bestätigung des Geldeingangs zurückziehen' %}"
|
||||||
|
class="btn btn-link no-padding">
|
||||||
|
<span class="text-success">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||||
|
</button>
|
||||||
|
{% elif event.charge and participant.paid %}
|
||||||
|
<span class="text-success" title="{% trans 'Geldeingang bestätigt' %}">
|
||||||
{% bootstrap_icon 'piggy-bank' %}
|
{% bootstrap_icon 'piggy-bank' %}
|
||||||
</span>
|
</span>
|
||||||
|
{% elif event.charge and has_permission_payment %}
|
||||||
|
<button name="action" value="confirm_payment"
|
||||||
|
title="{% trans 'Geldeingang bestätigen' %}"
|
||||||
|
class="btn btn-link no-padding">
|
||||||
|
<span class="text-danger">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||||
|
</button>
|
||||||
{% elif event.charge %}
|
{% elif event.charge %}
|
||||||
<span class="text-danger" title="Geldeingang unbestätigt">
|
<span class="text-danger" title="{% trans 'Geldeingang unbestätigt' %}">
|
||||||
{% bootstrap_icon 'piggy-bank' %}
|
{% bootstrap_icon 'piggy-bank' %}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="hidden" title="Keine Teilnehmergebühr gefordert">
|
<span class="hidden" title="{% trans 'Keine Teilnehmergebühr gefordert' %}">
|
||||||
{% bootstrap_icon 'piggy-bank' %}
|
{% bootstrap_icon 'piggy-bank' %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -366,9 +386,11 @@
|
|||||||
<input type="hidden" name="form_prefix" value="{{ form.prefix }}">
|
<input type="hidden" name="form_prefix" value="{{ form.prefix }}">
|
||||||
<input type="hidden" name="{{ form.prefix }}-id" value="{{ participant.id }}">
|
<input type="hidden" name="{{ form.prefix }}-id" value="{{ participant.id }}">
|
||||||
{% include './includes/participant_form.html' %}
|
{% include './includes/participant_form.html' %}
|
||||||
|
{% if not has_permission_update_participants %}
|
||||||
<button type="submit" name="action" value="update_participant" class="btn btn-success">
|
<button type="submit" name="action" value="update_participant" class="btn btn-success">
|
||||||
{% bootstrap_icon 'hdd' %} {% trans 'Speichern' %}
|
{% bootstrap_icon 'hdd' %} {% trans 'Speichern' %}
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class EventListView(generic.ListView):
|
|||||||
|
|
||||||
if has_role(user, 'publisher'):
|
if has_role(user, 'publisher'):
|
||||||
filter |= Q(flags__status__code='accepted')
|
filter |= Q(flags__status__code='accepted')
|
||||||
|
if has_role(user, 'office'):
|
||||||
|
filter |= Q(flags__status__code='submitted')
|
||||||
|
|
||||||
qs = self.model.objects.filter(filter)
|
qs = self.model.objects.filter(filter)
|
||||||
|
|
||||||
@@ -127,7 +129,8 @@ class EventPermissionMixin(object):
|
|||||||
user = self.request.user
|
user = self.request.user
|
||||||
return obj.workflow.has_permission(user, permission)
|
return obj.workflow.has_permission(user, permission)
|
||||||
|
|
||||||
def enforce_permission(self, obj):
|
def enforce_permission(self, obj, permission=None):
|
||||||
|
if permission is None:
|
||||||
permission = self.permission
|
permission = self.permission
|
||||||
if not self.has_permission(permission, obj):
|
if not self.has_permission(permission, obj):
|
||||||
raise PermissionDenied(permission)
|
raise PermissionDenied(permission)
|
||||||
@@ -162,15 +165,9 @@ class EventDetailView(EventPermissionMixin, generic.DetailView):
|
|||||||
|
|
||||||
|
|
||||||
class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
||||||
permission = 'update-registration'
|
|
||||||
model = models.Event
|
model = models.Event
|
||||||
template_name = 'dav_events/event_registrations.html'
|
template_name = 'dav_events/event_registrations.html'
|
||||||
|
|
||||||
def get_object(self, queryset=None):
|
|
||||||
obj = super(EventRegistrationsView, self).get_object(queryset=queryset)
|
|
||||||
self.enforce_permission(obj)
|
|
||||||
return obj
|
|
||||||
|
|
||||||
def get_form_kwargs(self, process_request=True):
|
def get_form_kwargs(self, process_request=True):
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if process_request and self.request.method in ('POST', 'PUT'):
|
if process_request and self.request.method in ('POST', 'PUT'):
|
||||||
@@ -208,6 +205,9 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
|||||||
context = super(EventRegistrationsView, self).get_context_data(**kwargs)
|
context = super(EventRegistrationsView, self).get_context_data(**kwargs)
|
||||||
event = context.get('event')
|
event = context.get('event')
|
||||||
context['has_permission_update'] = self.has_permission('update', event)
|
context['has_permission_update'] = self.has_permission('update', event)
|
||||||
|
context['has_permission_update_registration'] = self.has_permission('update-registration', event)
|
||||||
|
context['has_permission_update_participants'] = self.has_permission('update-participants', event)
|
||||||
|
context['has_permission_payment'] = self.has_permission('payment', event)
|
||||||
context['is_published_any'] = event.workflow.has_reached_status('published*')
|
context['is_published_any'] = event.workflow.has_reached_status('published*')
|
||||||
context['is_done'] = event.workflow.has_reached_status('expired')
|
context['is_done'] = event.workflow.has_reached_status('expired')
|
||||||
|
|
||||||
@@ -304,18 +304,28 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
|||||||
participant1.position = pos2
|
participant1.position = pos2
|
||||||
participant1.save()
|
participant1.save()
|
||||||
|
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
self.object = self.get_object()
|
||||||
|
self.enforce_permission(self.object, permission='view-participants')
|
||||||
|
context = self.get_context_data(object=self.object)
|
||||||
|
return self.render_to_response(context)
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
event = self.get_object()
|
self.object = self.get_object()
|
||||||
self.object = event
|
event = self.object
|
||||||
|
|
||||||
action = request.POST.get('action')
|
action = request.POST.get('action')
|
||||||
if action == 'close-registration':
|
if action == 'close-registration':
|
||||||
|
self.enforce_permission(event, permission='update-registration')
|
||||||
self._close_registration(request, event)
|
self._close_registration(request, event)
|
||||||
elif action == 'open-registration':
|
elif action == 'open-registration':
|
||||||
|
self.enforce_permission(event, permission='update-registration')
|
||||||
self._reopen_registration(request, event)
|
self._reopen_registration(request, event)
|
||||||
elif action == 'kill-deadline':
|
elif action == 'kill-deadline':
|
||||||
|
self.enforce_permission(event, permission='update-registration')
|
||||||
self._kill_deadline(request, event)
|
self._kill_deadline(request, event)
|
||||||
elif action == 'accept_registration':
|
elif action == 'accept_registration':
|
||||||
|
self.enforce_permission(event, permission='update-participants')
|
||||||
if hasattr(event, 'registrations'):
|
if hasattr(event, 'registrations'):
|
||||||
registration_id = request.POST.get('registration')
|
registration_id = request.POST.get('registration')
|
||||||
registration = event.registrations.get(id=registration_id)
|
registration = event.registrations.get(id=registration_id)
|
||||||
@@ -323,13 +333,27 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
|||||||
else:
|
else:
|
||||||
raise FieldDoesNotExist('Event has no registrations')
|
raise FieldDoesNotExist('Event has no registrations')
|
||||||
elif action == 'reject_registration':
|
elif action == 'reject_registration':
|
||||||
|
self.enforce_permission(event, permission='update-participants')
|
||||||
if hasattr(event, 'registrations'):
|
if hasattr(event, 'registrations'):
|
||||||
registration_id = request.POST.get('registration')
|
registration_id = request.POST.get('registration')
|
||||||
registration = event.registrations.get(id=registration_id)
|
registration = event.registrations.get(id=registration_id)
|
||||||
self._reject_registration(registration)
|
self._reject_registration(registration)
|
||||||
else:
|
else:
|
||||||
raise FieldDoesNotExist('Event has no registrations')
|
raise FieldDoesNotExist('Event has no registrations')
|
||||||
|
elif action == 'confirm_payment':
|
||||||
|
self.enforce_permission(event, permission='payment')
|
||||||
|
participant_id = request.POST.get('id')
|
||||||
|
participant = event.participants.get(id=participant_id)
|
||||||
|
participant.paid = True
|
||||||
|
participant.save()
|
||||||
|
elif action == 'revoke_payment':
|
||||||
|
self.enforce_permission(event, permission='payment')
|
||||||
|
participant_id = request.POST.get('id')
|
||||||
|
participant = event.participants.get(id=participant_id)
|
||||||
|
participant.paid = False
|
||||||
|
participant.save()
|
||||||
elif action == 'remove_participant':
|
elif action == 'remove_participant':
|
||||||
|
self.enforce_permission(event, permission='update-participants')
|
||||||
participant_id = request.POST.get('id')
|
participant_id = request.POST.get('id')
|
||||||
participant = event.participants.get(id=participant_id)
|
participant = event.participants.get(id=participant_id)
|
||||||
full_name = participant.get_full_name()
|
full_name = participant.get_full_name()
|
||||||
@@ -341,6 +365,7 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
|||||||
participant.save()
|
participant.save()
|
||||||
messages.success(request, _(u'Teilnehmer gelöscht: {}'.format(full_name)))
|
messages.success(request, _(u'Teilnehmer gelöscht: {}'.format(full_name)))
|
||||||
elif action == 'moveup_participant':
|
elif action == 'moveup_participant':
|
||||||
|
self.enforce_permission(event, permission='update-participants')
|
||||||
participant_id = request.POST.get('id')
|
participant_id = request.POST.get('id')
|
||||||
participant = event.participants.get(id=participant_id)
|
participant = event.participants.get(id=participant_id)
|
||||||
current_position = participant.position
|
current_position = participant.position
|
||||||
@@ -351,6 +376,7 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
|||||||
else:
|
else:
|
||||||
messages.error(request, 'Participant is already on first position')
|
messages.error(request, 'Participant is already on first position')
|
||||||
elif action == 'movedown_participant':
|
elif action == 'movedown_participant':
|
||||||
|
self.enforce_permission(event, permission='update-participants')
|
||||||
participant_id = request.POST.get('id')
|
participant_id = request.POST.get('id')
|
||||||
participant = event.participants.get(id=participant_id)
|
participant = event.participants.get(id=participant_id)
|
||||||
current_position = participant.position
|
current_position = participant.position
|
||||||
@@ -361,6 +387,7 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
|||||||
else:
|
else:
|
||||||
messages.error(request, 'Participant is already on last position')
|
messages.error(request, 'Participant is already on last position')
|
||||||
elif action == 'update_participant':
|
elif action == 'update_participant':
|
||||||
|
self.enforce_permission(event, permission='update-participants')
|
||||||
form = self.get_participant_form()
|
form = self.get_participant_form()
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
@@ -375,6 +402,7 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
|||||||
messages.error(request, _(u'Ungültige Eingabe - Siehe unten'))
|
messages.error(request, _(u'Ungültige Eingabe - Siehe unten'))
|
||||||
return self.render_to_response(self.get_context_data(participant_formset=formset))
|
return self.render_to_response(self.get_context_data(participant_formset=formset))
|
||||||
elif action == 'create_participant':
|
elif action == 'create_participant':
|
||||||
|
self.enforce_permission(event, permission='update-participants')
|
||||||
form = self.get_participant_form()
|
form = self.get_participant_form()
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
|
|||||||
@@ -415,6 +415,8 @@ class BasicWorkflow(object):
|
|||||||
return True
|
return True
|
||||||
if has_role(user, 'publisher') and self.has_reached_status('accepted'):
|
if has_role(user, 'publisher') and self.has_reached_status('accepted'):
|
||||||
return True
|
return True
|
||||||
|
if has_role(user, 'office') and self.has_reached_status('submitted'):
|
||||||
|
return True
|
||||||
elif permission == 'submit':
|
elif permission == 'submit':
|
||||||
if user == event.owner:
|
if user == event.owner:
|
||||||
return True
|
return True
|
||||||
@@ -437,7 +439,7 @@ class BasicWorkflow(object):
|
|||||||
return True
|
return True
|
||||||
elif has_role(user, 'publisher'):
|
elif has_role(user, 'publisher'):
|
||||||
return True
|
return True
|
||||||
elif permission == 'update-registration':
|
elif permission == 'view-participants':
|
||||||
if user == event.owner:
|
if user == event.owner:
|
||||||
return True
|
return True
|
||||||
if has_role(user, 'manager_super'):
|
if has_role(user, 'manager_super'):
|
||||||
@@ -446,6 +448,23 @@ class BasicWorkflow(object):
|
|||||||
return True
|
return True
|
||||||
if has_role(user, 'publisher'):
|
if has_role(user, 'publisher'):
|
||||||
return True
|
return True
|
||||||
|
if has_role(user, 'office'):
|
||||||
|
return True
|
||||||
|
elif permission == 'update-participants':
|
||||||
|
if user == event.owner:
|
||||||
|
return True
|
||||||
|
if has_role(user, 'manager_super'):
|
||||||
|
return True
|
||||||
|
elif permission == 'update-registration':
|
||||||
|
if user == event.owner:
|
||||||
|
return True
|
||||||
|
if has_role(user, 'manager_super'):
|
||||||
|
return True
|
||||||
|
if has_role(user, 'publisher'):
|
||||||
|
return True
|
||||||
|
elif permission == 'payment':
|
||||||
|
if has_role(user, 'office'):
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# TODO: is a class method a good idea?
|
# TODO: is a class method a good idea?
|
||||||
|
|||||||
Reference in New Issue
Block a user