From c10b0bac3f5d5ee61d7789de4db0fbb18dd666d3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 28 Oct 2013 19:31:45 +0100 Subject: Templates: list all dependant documents New template tags for displaying table of documents --- archaeological_finds/models.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'archaeological_finds') diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index f694ed562..53af78f8b 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -19,6 +19,7 @@ from django.conf import settings from django.contrib.gis.db import models +from django.core.urlresolvers import reverse from django.db.models import Max from django.utils.translation import ugettext_lazy as _, ugettext @@ -197,6 +198,14 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms): def __unicode__(self): return self.label + @property + def short_label(self): + return self.reference + + @property + def show_url(self): + return reverse('show-find', args=[self.pk, '']) + def get_first_base_find(self): q= self.base_finds if not q.count(): @@ -300,6 +309,10 @@ class FindSource(Source): find = models.ForeignKey(Find, verbose_name=_(u"Find"), related_name="source") + @property + def owner(self): + return self.find + class TreatmentType(GeneralType): virtual = models.BooleanField(_(u"Virtual")) class Meta: @@ -346,6 +359,10 @@ class TreatmentSource(Source): treatment = models.ForeignKey(Treatment, verbose_name=_(u"Treatment"), related_name="source") + @property + def owner(self): + return self.treatment + class Property(LightHistorizedItem): find = models.ForeignKey(Find, verbose_name=_(u"Find")) administrative_act = models.ForeignKey(AdministrativeAct, -- cgit v1.2.3