From 7e76b86d6f0176f9561876ae465e1483b15a246f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 26 Feb 2015 20:00:21 +0100 Subject: Automatically update raw_general_contractor and raw_town_planning_service on save - improve pdl import of raw_names and of dates --- ishtar_common/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index d5e0e5fc5..a99470c2b 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1630,6 +1630,15 @@ class Person(Address, Merge, OwnPerms, ValueGetter) : if getattr(self, attr)] return slugify(u"-".join(values)) + def save(self, *args, **kwargs): + super(Person, self).save(*args, **kwargs) + if hasattr(self, 'responsible_town_planning_service'): + for fle in self.responsible_town_planning_service.all(): + fle.save() # force update of raw_town_planning_service + if hasattr(self, 'general_contractor'): + for fle in self.general_contractor.all(): + fle.save() # force update of raw_general_contractor + class IshtarUser(User): person = models.ForeignKey(Person, verbose_name=_(u"Person"), unique=True, related_name='ishtaruser') -- cgit v1.2.3