summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
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):