--- a/src/p4l/models/data.py Thu Sep 12 17:26:15 2013 +0200
+++ b/src/p4l/models/data.py Thu Sep 12 18:17:53 2013 +0200
@@ -171,6 +171,9 @@
isDocumentPart = models.BooleanField() #iiep:isDocumentPart
isMultilingual = models.BooleanField() #iiep:isMultilingual
+
+ def get_imprints_years(self):
+ return set(sorted([i.imprintDate for i in self.imprints.all()]))
def __unicode__(self):
return "Record id %s { identifier: %s, uri: %s, editionStatement: %s, recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \
--- a/src/p4l/templates/p4l/p4l_home.html Thu Sep 12 17:26:15 2013 +0200
+++ b/src/p4l/templates/p4l/p4l_home.html Thu Sep 12 18:17:53 2013 +0200
@@ -36,7 +36,7 @@
{% endif %}
<table class="table">
<thead>
- <tr><td>{% trans 'identifier' %}</td><td>{% trans 'titles' %}</td><td>{% trans 'dates' %} (années imprint)</td><td class="two_buttons">{% trans 'actions' %}</td></tr>
+ <tr><td>{% trans 'identifier' %}</td><td>{% trans 'titles' %}</td><td>{% trans 'dates' %}</td><td class="two_buttons">{% trans 'actions' %}</td></tr>
</thead>
<tbody>
{% for record in object_list %}
@@ -45,7 +45,7 @@
<td><ul>{% for t in record.titles.all %}
<li>{{ t.title }}</li>
{% endfor %}</ul></td>
- <td> </td>
+ <td>{{ record.get_imprints_years|join:", "}}</td>
<td>
<a class="btn btn-default" href="{% url 'p4l_record_view' slug=record.identifier %}"><i class="glyphicon glyphicon-eye-open"></i></a>
<a class="btn btn-default" href="{% url 'p4l_record_edit' slug=record.identifier %}?previous={{request.get_full_path|urlencode}}"><i class="glyphicon glyphicon-pencil"></i></a>
--- a/src/p4l/views.py Thu Sep 12 17:26:15 2013 +0200
+++ b/src/p4l/views.py Thu Sep 12 18:17:53 2013 +0200
@@ -18,7 +18,7 @@
class RecordListView(ListView):
- queryset = Record.objects.select_related("language").prefetch_related('titles').distinct() # @UndefinedVariable
+ queryset = Record.objects.select_related("language").prefetch_related('titles', 'imprints').distinct() # @UndefinedVariable
paginate_by = settings.NB_RECORDS_BY_PAGE
template_name = "p4l/p4l_home.html"
form_class = RecordFilterForm