# HG changeset patch # User ymh # Date 1379002673 -7200 # Node ID eb6530b77b0e93c206a2c3c411ebdc119b71446b # Parent ad7d84868c9865587270ed1266c73ea492a34703 Add years in list view diff -r ad7d84868c98 -r eb6530b77b0e src/p4l/models/data.py --- 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}" \ diff -r ad7d84868c98 -r eb6530b77b0e src/p4l/templates/p4l/p4l_home.html --- 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 %} - + {% for record in object_list %} @@ -45,7 +45,7 @@ - +
{% trans 'identifier' %}{% trans 'titles' %}{% trans 'dates' %} (années imprint){% trans 'actions' %}
{% trans 'identifier' %}{% trans 'titles' %}{% trans 'dates' %}{% trans 'actions' %}
    {% for t in record.titles.all %}
  • {{ t.title }}
  • {% endfor %}
 {{ record.get_imprints_years|join:", "}} diff -r ad7d84868c98 -r eb6530b77b0e src/p4l/views.py --- 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