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.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 5e3b05097..7d13669b1 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -416,6 +416,12 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
return {'date':item.history_date,
'user':IshtarUser.objects.get(pk=item.history_modifier_id)}
+ def save(self, *args, **kwargs):
+ # put a default year if start_date is defined
+ if self.start_date and not self.year:
+ self.year = self.start_date.year
+ return super(Operation, self).save(*args, **kwargs)
+
m2m_changed.connect(cached_label_changed, sender=Operation.towns.through)
def operation_post_save(sender, **kwargs):