request: affiche aussi le service, le diplôme et la version du diplôme lié à une demande dans les listings et les imprimés
This commit is contained in:
parent
3b0bac9bf5
commit
b701f09bea
|
@ -1,4 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
# Request display
|
||||
PAGINATE_BY = getattr(settings, "PAGINATE_BY", 50)
|
||||
|
@ -12,3 +14,10 @@ MIN_ENTITY_FILTER_DEPTH = getattr(settings, 'MIN_ENTITY_FILTER_DEPTH', ENTITY_RO
|
|||
MAX_ENTITY_FILTER_DEPTH = getattr(settings, 'MAX_DOCUMENT_SIZE', 4)
|
||||
|
||||
USE_PDF_VIEWER = getattr(settings, 'USE_PDF_VIEWER', False)
|
||||
|
||||
# entity level to show
|
||||
ENTITY_TYPE_TO_SHOW = getattr(settings, 'ENTITY_TYPE_TO_SHOW',
|
||||
((_(u'Service'), 'service'),
|
||||
(_(u'Diplôme'), 'diplome'),
|
||||
(_(u'Version diplôme'), 'version diplome'),
|
||||
))
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
{% include "detail_template.html" with value=poly_request.sponsor_display name="Commanditaire" %}
|
||||
{% include "detail_template.html" with value=poly_request.status name="Statut" %}
|
||||
|
||||
{% if poly_request.entity.level1_parent %}
|
||||
{% include "detail_template.html" with value=poly_request.entity.level1_parent.get_description|lower|capfirst name="Composante ou service" %}
|
||||
{% endif %}
|
||||
{% for caption, value in entities %}
|
||||
{% include "detail_template.html" with value=value name=caption %}
|
||||
{% endfor %}
|
||||
{% include "detail_template.html" with value=poly_request.entity.get_description|lower|capfirst name="Entité demandeur" %}
|
||||
{% if poly_request.history_set.latest.description %}
|
||||
<p><strong>Dernier commentaire de {{ poly_request.history_set.latest.user }} </strong>: « {{ poly_request.history_set.latest.description }} »</p>
|
||||
|
|
|
@ -291,6 +291,15 @@ class RequestDetails(DetailView):
|
|||
transitions.append(transition)
|
||||
ctx['workflows'] = transitions
|
||||
ctx['use_pdf_viewer'] = app_settings.USE_PDF_VIEWER
|
||||
ctx['entities'] = []
|
||||
if request.entity is not None:
|
||||
def entity_parent(x, kind):
|
||||
return getattr(x.entity.parent_of_type(kind), 'description', None)
|
||||
for caption, ref in app_settings.ENTITY_TYPE_TO_SHOW:
|
||||
what = entity_parent(request, ref)
|
||||
if what is None or what == request.entity:
|
||||
continue
|
||||
ctx['entities'].append((caption, what))
|
||||
return ctx
|
||||
|
||||
class RequestHistory(DetailView):
|
||||
|
@ -670,7 +679,14 @@ class CSVListRequest(ListRequest):
|
|||
'copyright',
|
||||
'comments',
|
||||
'sponsor',
|
||||
'entity__description',
|
||||
('Entité', 'entity__description')]
|
||||
def loader(kind):
|
||||
def entity_parent(x):
|
||||
return getattr(x.entity.parent_of_type(kind), 'description', None)
|
||||
return entity_parent
|
||||
for caption, ref in app_settings.ENTITY_TYPE_TO_SHOW:
|
||||
fields.append((caption.encode('utf-8'), loader(ref)))
|
||||
fields += [
|
||||
'copies',
|
||||
'status__name',
|
||||
'base_profile__name',
|
||||
|
|
Reference in New Issue