summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
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
commitd8590171c727a9bd3cc3deca0fc8189f1da53227 (patch)
tree10b2770b19fde76764d3a028fd01ae3ebe8176f5 /archaeological_operations/models.py
parent2789ba690ffc72c17f47a1c705edd28c5cb72cd7 (diff)
downloadIshtar-d8590171c727a9bd3cc3deca0fc8189f1da53227.tar.bz2
Ishtar-d8590171c727a9bd3cc3deca0fc8189f1da53227.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.py11
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):