diff options
| author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-17 01:53:53 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-17 01:53:53 +0100 | 
| commit | 758ee42b4970372d38d620f80c51854abc64a69f (patch) | |
| tree | 10b2770b19fde76764d3a028fd01ae3ebe8176f5 /archaeological_operations/models.py | |
| parent | 7a8588afd998504e4fabf9614d03054b424fe3e7 (diff) | |
| download | Ishtar-758ee42b4970372d38d620f80c51854abc64a69f.tar.bz2 Ishtar-758ee42b4970372d38d620f80c51854abc64a69f.zip | |
Choose document to generate at the end of create/modif process
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 125a5d7d1..be09f9923 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -425,11 +425,16 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):              filename += u"-" + self.signature_date.strftime('%Y%m%d')          return filename -    def publish(self): +    def publish(self, template_pk=None):          if not self.act_type.associated_template.count():              return -        # for administrative_act only one associated_template -        template = self.act_type.associated_template.all()[0] +        if not template_pk: +            template = self.act_type.associated_template.all()[0] +        else: +            q = self.act_type.associated_template.filter(pk=template_pk) +            if not q.count(): +                return +            template = q.all()[0]          return template.publish(self)  class Parcel(LightHistorizedItem): | 
