Add description field to TrainingItems (#523)

* Add 'description' field to TrainingItems

Renamed existing field to name, removed the dummy property.

* Initial version of training item export view

* Fix line length issue and better spacing on exported PDF

* Added export button to item list

* pep8

* Implement code doctor tweaks

* Attempt to fix odd deployment issue

* Pad headers slightly

* Fix page numbering
This commit is contained in:
2023-02-22 21:07:43 +00:00
committed by GitHub
parent 6550ed2318
commit 8863d86ed0
16 changed files with 144 additions and 41 deletions

View File

@@ -7,7 +7,7 @@ from django.db import transaction
from django.db.models import Q, Count
from django.db.utils import IntegrityError
from PyRIGS.views import is_ajax, ModalURLMixin, get_related
from PyRIGS.views import is_ajax, ModalURLMixin, get_related, PrintListView
from training import models, forms
from users import views
from reversion.views import RevisionMixin
@@ -24,6 +24,17 @@ class ItemList(generic.ListView):
return context
class ItemListExport(PrintListView):
model = models.TrainingItem
template_name = 'item_list.xml'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['filename'] = "TrainingItemList.pdf"
context["categories"] = models.TrainingCategory.objects.all()
return context
class TraineeDetail(views.ProfileDetail):
template_name = "trainee_detail.html"
model = models.Trainee