mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-02-09 00:09:44 +00:00
Rework of subhire list
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from django.urls import reverse_lazy
|
||||
from django.views import generic
|
||||
from django.db.models import Sum
|
||||
from PyRIGS.views import ModalURLMixin, get_related
|
||||
from RIGS import models, forms
|
||||
from RIGS.views import EventArchive
|
||||
|
||||
|
||||
class SubhireDetail(generic.DetailView, ModalURLMixin):
|
||||
@@ -48,11 +50,13 @@ class SubhireEdit(generic.UpdateView):
|
||||
return reverse_lazy('subhire_detail', kwargs={'pk': self.object.pk})
|
||||
|
||||
|
||||
class SubhireList(generic.TemplateView):
|
||||
template_name = 'rigboard.html'
|
||||
class SubhireList(EventArchive):
|
||||
template_name = 'subhire_list.html'
|
||||
model = models.Subhire
|
||||
paginate_by = 25
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['events'] = models.Subhire.objects.current_events()
|
||||
context['page_title'] = "Upcoming Subhire"
|
||||
context['total_value'] = self.get_queryset().aggregate(sum=Sum('insurance_value'))['sum']
|
||||
context['page_title'] = "Subhire List"
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user