summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-23 14:43:48 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-23 14:43:48 +0200
commitf5fc6f23f5369df98fb0fdb061bfbac3c9662677 (patch)
tree2abd184b08e73352ccb9ddb078b1d48122b5e472 /archaeological_context_records
parentd267f410a54aa76b7f9fe02cd754a270f56b3a04 (diff)
downloadIshtar-f5fc6f23f5369df98fb0fdb061bfbac3c9662677.tar.bz2
Ishtar-f5fc6f23f5369df98fb0fdb061bfbac3c9662677.zip
Hide parcel field for UE QA - Add cultural atribution for sites
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/forms.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index 72877c2e2..5d98b9718 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -445,6 +445,8 @@ class QAOperationCR(IshtarForm):
if self.profil.parcel_mandatory:
self.fields['parcel'].required = True
self.fields.pop('town')
+ else:
+ self.fields.pop("parcel")
if not self.items:
return
@@ -456,10 +458,11 @@ class QAOperationCR(IshtarForm):
(site.pk, str(site))
for site in operation.archaeological_sites.all()
]
- self.fields['parcel'].choices += [('', '--')] + [
- (str(parcel.pk), u"{} - {}".format(parcel.short_label, parcel.town))
- for parcel in operation.parcels.all()
- ]
+ if self.profil.parcel_mandatory:
+ self.fields['parcel'].choices += [('', '--')] + [
+ (str(parcel.pk), u"{} - {}".format(parcel.short_label,
+ parcel.town))
+ for parcel in operation.parcels.all()]
def save(self, items):
operation = items[0]
@@ -473,7 +476,5 @@ class QAOperationCR(IshtarForm):
if self.profil.parcel_mandatory:
data["parcel_id"] = self.cleaned_data['parcel']
else:
- if self.cleaned_data.get('parcel', None):
- data["parcel_id"] = self.cleaned_data['parcel']
data["town_id"] = self.cleaned_data['town']
models.ContextRecord.objects.create(**data)