diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-06-17 02:41:03 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-06-17 02:41:03 +0200 |
commit | 13d8f07c11f19b96678442571317162f868eff4a (patch) | |
tree | 42983cf4fc100c70a1e22b3cf20f3b492eab94ed /archaeological_operations/models.py | |
parent | a373fe1eda73658259bff54a0eab3a922c10c74b (diff) | |
parent | e803c522a72359685080f41c01fcd8e66197e498 (diff) | |
download | Ishtar-13d8f07c11f19b96678442571317162f868eff4a.tar.bz2 Ishtar-13d8f07c11f19b96678442571317162f868eff4a.zip |
Merge branch 'stable'
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 20d7cf79f..6b44fb924 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -722,7 +722,6 @@ class Parcel(LightHistorizedItem): for nb in grouped[-1].parcel_numbers] return grouped - @classmethod def render_parcels(cls, parcels): parcels = cls.grouped_parcels(parcels) @@ -753,9 +752,16 @@ class Parcel(LightHistorizedItem): return settings.JOINT.join(items) def parcel_post_save(sender, **kwargs): - if not kwargs['instance'] or not FILES_AVAILABLE: + if not kwargs['instance']: return parcel = kwargs['instance'] + if parcel.operation and parcel.town not in parcel.operation.towns.all(): + parcel.operation.towns.add(parcel.town) + elif FILES_AVAILABLE and parcel.associated_file and \ + parcel.town not in parcel.associated_file.towns.all(): + parcel.associated_file.towns.add(parcel.town) + if not FILES_AVAILABLE: + return if parcel.operation and parcel.associated_file: return if parcel.operation and parcel.operation.associated_file: |