diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-05 00:25:32 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-05 00:25:32 +0100 |
commit | 9faccac25a1e69eac319cd089d383176871acc9e (patch) | |
tree | 13df6c1a35009a87255d283671f8cb679c5d93b4 /archaeological_operations/models.py | |
parent | 39ae57f6f233cc097d303b397b78b9bfdd9b894b (diff) | |
download | Ishtar-9faccac25a1e69eac319cd089d383176871acc9e.tar.bz2 Ishtar-9faccac25a1e69eac319cd089d383176871acc9e.zip |
Better filenames for ooo document (refs #1526)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index a3af9a0f7..04ad867fc 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -353,6 +353,7 @@ class ActType(GeneralType): ) intented_to = models.CharField(_(u"Intended to"), max_length=1, choices=TYPE) + code = models.CharField(_(u"Code"), max_length=10, blank=True, null=True) associated_template = models.ManyToManyField(DocumentTemplate, blank=True, null=True, verbose_name=_(u"Associated template")) class Meta: @@ -411,6 +412,19 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): for item in [self.operation, self.associated_file, self.act_object] if item]) + def get_filename(self, operation=False): + filename = '' + if operation and self.operation: + filename = self.operation.associated_filename + else: + filename = self.associated_file.associated_filename + filename = u"-".join(filename.split('-')[:-1]) # remove date + if self.act_type.code: + filename += u"-" + self.act_type.code + if self.signature_date: + filename += u"-" + self.signature_date.strftime('%Y%m%d') + return filename + def publish(self): if not self.act_type.associated_template.count(): return |