diff options
Diffstat (limited to 'archaeological_context_records')
-rw-r--r-- | archaeological_context_records/forms.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 594ed1346..157da64e1 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -695,10 +695,13 @@ class QAContextRecordFormMulti(QAForm): form_admin_name = _("Context record - Quick action - Modify") form_slug = "contextrecord-quickaction-modify" - base_models = ["qa_relation_type"] + base_models = ["qa_relation_type", "qa_related_to", "qa_unit"] associated_models = { "qa_relation_type": models.RelationType, + "qa_related_to": models.ContextRecord, + "qa_unit": models.Unit, } + REPLACE_FIELDS = ["qa_unit"] MULTI = True qa_relation_type = forms.ChoiceField( @@ -714,9 +717,11 @@ class QAContextRecordFormMulti(QAForm): validators=[valid_id(models.ContextRecord)], required=False, ) + qa_unit = forms.ChoiceField(label=_("Unit type"), choices=[], required=False) TYPES = [ FieldType("qa_relation_type", models.RelationType), + FieldType("qa_unit", models.Unit), ] def clean(self): @@ -730,6 +735,12 @@ class QAContextRecordFormMulti(QAForm): ) ) + def _get_qa_related_to(self, value): + try: + return str(models.ContextRecord.objects.get(pk=value)) + except models.ContextRecord.DoesNotExist: + return "" + def _set_qa_related_to(self, item, __): r_type = self.cleaned_data.get("qa_relation_type", None) r_related = self.cleaned_data.get("qa_related_to", None) |