Skip to content
Snippets Groups Projects
Commit ae4c070d authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add event detail page

parent fedcb0f9
No related branches found
No related tags found
1 merge request!23Resolve "Event detail page"
Pipeline #70733 passed with warnings
{# -*- engine:django -*- #}
{% extends "core/base.html" %}
{% load i18n static rules material_form %}
{% load render_table from django_tables2 %}
{% block browser_title %}{{ event }}{% endblock %}
{% block content %}
<h4>{{ event }}</h4>
{% has_perm 'paweljong.manage_event' user event as can_manage_event %}
{% has_perm 'paweljong.delete_event' user event as can_delete_event %}
{% has_perm 'paweljong.send_notification_mail' user event as can_send_notification %}
{% has_perm 'tezor.view_invoice_rule' user event as can_view_invoice %}
{% has_perm 'core.edit_person_rule' user person as can_change_person %}
{% if can_manage_event or can_manage_event_preferences or can_delete_event or can_send_notification %}
<p>
{% if can_manage_event %}
<a href="{% url 'edit_event_by_pk' event.pk %}" class="btn waves-effect waves-light">
<i class="material-icons left iconify" data-icon="mdi:edit"></i>
{% trans "Edit" %}
</a>
{% endif %}
{% if can_delete_event %}
<a href="{% url 'delete_event_by_pk' event.pk %}" class="btn waves-effect waves-light red">
<i class="material-icons left iconify" data-icon="mdi:delete"></i>
{% trans "Delete" %}
</a>
{% endif %}
</p>
{% endif %}
<h5>{% blocktrans %}Registrations</h5>
{% render_table registrations_table %}
{% endblock %}
......@@ -43,6 +43,7 @@ urlpatterns = [
name="register_event_by_slug",
),
path("event/<slug:slug>", views.EventFullView.as_view(), name="event_by_name"),
path("event/<slug:slug>/detail", views.EventDetailView.as_view(), name="event_detail_by_name"),
path(
"event/<slug:slug>/start",
views.RegisterEventStart.as_view(),
......
......@@ -899,3 +899,28 @@ class RegistrationStateEditView(PermissionRequiredMixin, AdvancedEditView):
template_name = "paweljong/registration_state/edit.html"
success_url = reverse_lazy("registration_states")
success_message = _("The term has been saved.")
class EventDetailView(PermissionRequiredMixin, DetailView):
"""Detail view for an event instance."""
context_object_name = "event"
permission_required = "paweljong.view_event_rule"
template_name = "paweljong/event/detail.html"
model = Event
slug_field = "slug"
def get_queryset(self):
return Event.objects.all()
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# Build table
registrations = EventRegistration.objects.filter(event=self.object)
registrations_table = EventRegistrationsTable(registrations)
RequestConfig(request).configure(registrations_table)
context["registrations_table"] = registrations_table
return context
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment