Skip to content
Snippets Groups Projects
Commit ba8704fb authored by Lorenzo Conti's avatar Lorenzo Conti
Browse files

Merge branch 'fix/json-export-view' into 'main'

Change JSONExportView to DetailView of an Event

See merge request !23
parents abe8fc86 3a211c60
No related branches found
No related tags found
4 merge requests!262[WIP] compatibility with koma solver import/export,!261[WIP] compatibility with koma solver import/export,!259Add view to clear schedule,!235Merge fork for interoperability of KoMa solver
...@@ -39,23 +39,20 @@ class AKCSVExportView(AdminViewMixin, FilterByEventSlugMixin, ListView): ...@@ -39,23 +39,20 @@ class AKCSVExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
return super().get_queryset().order_by("ak__track") return super().get_queryset().order_by("ak__track")
class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView): class AKJSONExportView(AdminViewMixin, DetailView):
""" """
View: Export all AK slots of this event in JSON format ordered by tracks View: Export all AK slots of this event in JSON format ordered by tracks
""" """
template_name = "admin/AKModel/ak_json_export.html" template_name = "admin/AKModel/ak_json_export.html"
model = AKSlot model = Event
context_object_name = "slots" context_object_name = "event"
title = _("AK JSON Export") title = _("AK JSON Export")
slug_url_kwarg = "event_slug"
def get_queryset(self):
return super().get_queryset().order_by("ak__track")
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
data = self.event.as_json_dict() data = context["event"].as_json_dict()
context["json_data_oneline"] = json.dumps(data) context["json_data_oneline"] = json.dumps(data)
context["json_data"] = json.dumps(data, indent=2) context["json_data"] = json.dumps(data, indent=2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment