diff options
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 1dad60ea1..cba230338 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -338,6 +338,8 @@ ParcelFormSet.form_label = _(u"Parcels") class RecordRelationsForm(forms.Form): base_model = 'right_relation' + current_model = models.RelationType + current_related_model = models.Operation associated_models = {'right_record': models.Operation, 'relation_type': models.RelationType} relation_type = forms.ChoiceField(label=_(u"Relation type"), @@ -373,14 +375,14 @@ class RecordRelationsForm(forms.Form): if not data: continue try: - relation_type = models.RelationType.objects.get( + relation_type = cls.current_model.objects.get( pk=data.get('relation_type')) - except models.RelationType.DoesNotExist: + except cls.current_model.DoesNotExist: continue try: - right_record = models.Operation.objects.get( + right_record = cls.current_related_model.objects.get( pk=data.get('right_record')) - except models.Operation.DoesNotExist: + except cls.current_related_model.DoesNotExist: continue values = [unicode(relation_type), right_record.reference] if data.get('DELETE'): |