summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-05-12 21:21:04 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2014-05-12 21:23:12 +0200
commit0044979f420102dde6b876ec7a9e986e9c62cda7 (patch)
treee69bfd5b3bc0843ec93223dc12d4a376d6b489c0 /archaeological_operations
parente377a4c28bfc63170dd5cbf182493bbc6bf590e0 (diff)
downloadIshtar-0044979f420102dde6b876ec7a9e986e9c62cda7.tar.bz2
Ishtar-0044979f420102dde6b876ec7a9e986e9c62cda7.zip
Person and organization deletion (refs #1675)
* add associated actions, wizards, forms * prevent deletion of associted items (operations, files, etc.) * give list of associated items before deletion and give access to these items
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/models.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 7bd84c6e7..97d10801c 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -144,11 +144,14 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter):
null=True, blank=True)
scientist = models.ForeignKey(Person, blank=True, null=True,
verbose_name=_(u"In charge scientist"),
+ on_delete=models.SET_NULL,
related_name='operation_scientist_responsability')
operator = models.ForeignKey(Organization, blank=True, null=True,
- verbose_name=_(u"Operator"))
+ related_name='operator',
+ verbose_name=_(u"Operator"), on_delete=models.SET_NULL)
in_charge = models.ForeignKey(Person, blank=True, null=True,
verbose_name=_(u"In charge"),
+ on_delete=models.SET_NULL,
related_name='operation_responsability')
year = models.IntegerField(_(u"Year"), null=True, blank=True)
operation_code = models.IntegerField(_(u"Operation code"), null=True,
@@ -190,8 +193,10 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter):
geoarchaeological_context_prescription = models.NullBooleanField(
_(u"Prescription on geoarchaeological context"),
blank=True, null=True) # preventive diag
- cira_rapporteur = models.ForeignKey(Person, related_name='+', null=True,
- blank=True, verbose_name=u"Rapporteur CIRA")
+ cira_rapporteur = models.ForeignKey(Person,
+ related_name='cira_rapporteur', null=True,
+ blank=True, on_delete=models.SET_NULL,
+ verbose_name=u"Rapporteur CIRA")
negative_result = models.NullBooleanField(
u"Résultat considéré comme négatif", blank=True, null=True)
cira_date = models.DateField(u"Date avis CIRA", null=True, blank=True)
@@ -464,15 +469,20 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
TABLE_COLS_OPE = ['full_ref', 'act_type', 'operation', 'operation.towns']
act_type = models.ForeignKey(ActType, verbose_name=_(u"Act type"))
in_charge = models.ForeignKey(Person, blank=True, null=True,
- related_name='+', verbose_name=_(u"Person in charge of the operation"))
+ related_name='adminact_operation_in_charge',
+ verbose_name=_(u"Person in charge of the operation"),
+ on_delete=models.SET_NULL,)
index = models.IntegerField(verbose_name=_(u"Index"), blank=True, null=True)
operator = models.ForeignKey(Organization, blank=True, null=True,
- verbose_name=_(u"Archaeological preventive operator"))
+ verbose_name=_(u"Archaeological preventive operator"),
+ related_name='adminact_operator',
+ on_delete=models.SET_NULL)
scientist = models.ForeignKey(Person, blank=True, null=True,
- related_name='+',
- verbose_name=_(u"Scientist in charge"))
+ related_name='adminact_scientist', on_delete=models.SET_NULL,
+ verbose_name=_(u"Scientist in charge"))
signatory = models.ForeignKey(Person, blank=True, null=True,
- related_name='+', verbose_name=_(u"Signatory"))
+ related_name='signatory', verbose_name=_(u"Signatory"),
+ on_delete=models.SET_NULL,)
operation = models.ForeignKey(Operation, blank=True, null=True,
related_name='administrative_act', verbose_name=_(u"Operation"))
if FILES_AVAILABLE:
@@ -649,7 +659,8 @@ def parcel_post_save(sender, **kwargs):
post_save.connect(parcel_post_save, sender=Parcel)
class ParcelOwner(LightHistorizedItem):
- owner = models.ForeignKey(Person, verbose_name=_(u"Owner"))
+ owner = models.ForeignKey(Person, verbose_name=_(u"Owner"),
+ related_name="parcel_owner")
parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel"))
start_date = models.DateField(_(u"Start date"))
end_date = models.DateField(_(u"End date"))