diff options
| author | Étienne Loks <etienne.loks@proxience.com> | 2015-07-07 13:58:02 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@proxience.com> | 2015-07-07 13:58:02 +0200 | 
| commit | 269996fd319ab2c892b5e4518c0e5091056a3f1a (patch) | |
| tree | 07bf6a89108216756bdca031765107afd429fabc | |
| parent | 586686fe3e13bc66d649bd367349b888f8590801 (diff) | |
| parent | 9731cd9dc5e1dbfee167d99e1d0b4403916cb0ef (diff) | |
| download | Ishtar-269996fd319ab2c892b5e4518c0e5091056a3f1a.tar.bz2 Ishtar-269996fd319ab2c892b5e4518c0e5091056a3f1a.zip  | |
Merge branch 'stable'
| -rw-r--r-- | archaeological_operations/models.py | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index cf2dcc0d6..8f69dd2e0 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -436,6 +436,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,          if self.start_date and not self.year:              self.year = self.start_date.year          # manage parcel association +        """          if FILES_AVAILABLE and self.associated_file:              for parcel in self.associated_file.parcels.exclude(                                          operation=self).all(): @@ -452,7 +453,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,                      parcel.merge(parcels[keys])                  else:                      parcels[keys] = parcel - +        """          return super(Operation, self).save(*args, **kwargs)  m2m_changed.connect(cached_label_changed, sender=Operation.towns.through) @@ -800,9 +801,11 @@ def parcel_post_save(sender, **kwargs):          parcel.external_id = (parcel.section or "") + (parcel.parcel_number or "")          parcel.save()          return -    if parcel.operation and parcel.town not in list(parcel.operation.towns.all()): +    if parcel.operation and parcel.operation.pk and \ +       parcel.town not in list(parcel.operation.towns.all()):          parcel.operation.towns.add(parcel.town)      if FILES_AVAILABLE and parcel.associated_file and \ +       parcel.associated_file.pk and \         parcel.town not in list(parcel.associated_file.towns.all()):          parcel.associated_file.towns.add(parcel.town)      if not FILES_AVAILABLE:  | 
