Add new routes for print export for power tests

This commit is contained in:
Joe Banks
2024-10-13 00:26:12 +01:00
parent 78a77b0c24
commit c08d21db8d
2 changed files with 9 additions and 0 deletions

View File

@@ -100,6 +100,7 @@ urlpatterns = [
name='pt_edit'),
path('event/power/<int:pk>/review/', permission_required_with_403('RIGS.review_power')(views.MarkReviewed.as_view()),
name='pt_review', kwargs={'model': 'PowerTestRecord'}),
path('event/power/<int:pk>/print/', permission_required_with_403('RIGS.view_powertestrecord')(views.PowerPrint.as_view()), name='pt_print'),
path('event/<int:pk>/checkin/', login_required(views.EventCheckIn.as_view()),
name='event_checkin'),

View File

@@ -231,6 +231,14 @@ class RAPrint(PrintView):
context['filename'] = f"EventSpecificRiskAssessment_for_{context['object'].event.display_id}.pdf"
return context
class PowerPrint(PrintView):
model = models.PowerTestRecord
template_name = 'hs/power_print.xml'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['filename'] = f"PowerTestRecord_for_{context['object'].event.display_id}.pdf"
return context
class EventCheckIn(generic.CreateView, ModalURLMixin):
model = models.EventCheckIn