Also apply better approach to generic detail pages

This commit is contained in:
2020-10-08 23:15:55 +01:00
parent 3903481b3d
commit 5d56f4f7b0
11 changed files with 71 additions and 34 deletions

View File

@@ -1 +0,0 @@
{% include 'generic_detail.html' with type='Organisation' history_link='organisation_history' detail_link='organisation_detail' update_link='organisation_update' associated='partials/associated_people.html' associated2='partials/associated_events.html' %}

View File

@@ -1 +0,0 @@
{% include 'generic_detail.html' with type='Person' history_link='person_history' detail_link='person_detail' update_link='person_update' associated='partials/associated_organisations.html' associated2='partials/associated_events.html' %}

View File

@@ -1 +0,0 @@
{% include 'generic_detail.html' with type='Venue' history_link='venue_history' detail_link='venue_detail' update_link='venue_update' associated2='partials/associated_events.html' %}

View File

@@ -20,7 +20,7 @@ from RIGS import models, forms
from assets import models as asset_models
from functools import reduce
from PyRIGS.views import GenericListView
from PyRIGS.views import GenericListView,GenericDetailView
class PersonList(GenericListView):
@@ -35,10 +35,18 @@ class PersonList(GenericListView):
return context
class PersonDetail(generic.DetailView):
template_name = 'person_detail.html'
class PersonDetail(GenericDetailView):
model = models.Person
def get_context_data(self, **kwargs):
context = super(PersonDetail, self).get_context_data(**kwargs)
context['history_link'] = 'person_history'
context['detail_link'] = 'person_detail'
context['update_link'] = 'person_update'
context['associated'] ='partials/associated_organisations.html'
context['associated2'] ='partials/associated_events.html'
return context
class PersonCreate(generic.CreateView):
template_name = 'person_form.html'
@@ -87,10 +95,17 @@ class OrganisationList(GenericListView):
context['union_account'] = True
return context
class OrganisationDetail(generic.DetailView):
template_name = 'organisation_detail.html'
class OrganisationDetail(GenericDetailView):
model = models.Organisation
def get_context_data(self, **kwargs):
context = super(OrganisationDetail, self).get_context_data(**kwargs)
context['history_link'] = 'organisation_history'
context['detail_link'] = 'organisation_detail'
context['update_link'] = 'organisation_update'
context['associated'] ='partials/associated_people.html'
context['associated2'] ='partials/associated_events.html'
return context
class OrganisationCreate(generic.CreateView):
template_name = 'organisation_form.html'
@@ -139,10 +154,17 @@ class VenueList(GenericListView):
return context
class VenueDetail(generic.DetailView):
template_name = 'venue_detail.html'
class VenueDetail(GenericDetailView):
model = models.Venue
def get_context_data(self, **kwargs):
context = super(VenueDetail, self).get_context_data(**kwargs)
context['history_link'] = 'venue_history'
context['detail_link'] = 'venue_detail'
context['update_link'] = 'venue_update'
context['associated2'] = 'partials/associated_events.html'
return context
class VenueCreate(generic.CreateView):
template_name = 'venue_form.html'