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

@@ -1,6 +1,11 @@
{% extends 'base_training.html' %}
{% load button from filters %}
{% block content %}
<div class="col-12 text-right py-2 pr-0">
{% button 'print' 'item_list_export' %}
</div>
<div id="accordion">
{% for category in categories %}
<div class="card">
@@ -13,7 +18,8 @@
<div class="card-body">
<div class="list-group list-group-flush">
{% for item in category.items.all %}
<li class="list-group-item {% if not item.active%}text-warning{%endif%}">{{ item }}
<li class="list-group-item {% if not item.active%}text-warning{%endif%}">{{ item }} <a href="{% url 'item_qualification' item.pk %}" class="btn btn-info float-right"><span class="fas fa-user"></span> Qualified Users</a>
<br><small>{{ item.description }}</small>
{% if item.prerequisites.exists %}
<div class="ml-3 font-italic">
<p class="text-info mb-0">Passed Out Prerequisites:</p>
@@ -24,7 +30,6 @@
</ul>
</div>
{% endif %}
<a href="{% url 'item_qualification' item.pk %}" class="btn btn-info"><span class="fas fa-user"></span> Qualified Users</a>
</li>
{% endfor %}
</div>

View File

@@ -0,0 +1,25 @@
{% extends 'base_print.xml' %}
{% block content %}
<h1 style="page-head">TEC Training Item List</h1>
<spacer length="15" />
{% for category in categories %}
<h2 {% if not forloop.first %}style="breakbefore"{%else%}style="emheader"{%endif%}>{{category}}</h2>
<spacer length="10" />
{% for item in category.items.all %}
<h3>{{ item }}</h3>
<spacer length="4" />
<para>{{ item.description }}</para>
{% if item.prerequisites.exists %}
<h4>Prerequisites:</h4>
<ul bulletFontSize="5">
{% for p in item.prerequisites.all %}
<li><para>{{p}}</para></li>
{% endfor %}
</ul>
{% endif %}
<spacer length="8" />
{% endfor %}
{% endfor %}
<namedString id="lastPage"><pageNumber/></namedString>
{% endblock %}