diff --git a/cadasta/organization/forms.py b/cadasta/organization/forms.py index ddbdf5f55..811c012b2 100644 --- a/cadasta/organization/forms.py +++ b/cadasta/organization/forms.py @@ -7,6 +7,7 @@ from core.util import slugify from django.utils.translation import ugettext as _ from django.db import transaction +from django.forms.utils import ErrorDict from leaflet.forms.widgets import LeafletWidget from tutelary.models import Role @@ -63,6 +64,7 @@ def full_clean(self): if self.data.get(self.prefix + '-remove') != 'on': super().full_clean() else: + self._errors = ErrorDict() self.cleaned_data = {'remove': True} def clean(self): diff --git a/cadasta/organization/tests/test_forms.py b/cadasta/organization/tests/test_forms.py index 17a1acf03..176f55547 100644 --- a/cadasta/organization/tests/test_forms.py +++ b/cadasta/organization/tests/test_forms.py @@ -4,6 +4,7 @@ from zipfile import ZipFile from django.conf import settings +from django.forms.utils import ErrorDict from buckets.test import utils as bucket_uitls from buckets.test.storage import FakeS3Storage @@ -561,6 +562,7 @@ def test_full_clean_remove(self): form = forms.ContactsForm(data=data, prefix='contacts') form.full_clean() assert form.cleaned_data == {'remove': True} + assert isinstance(form._errors, ErrorDict) def test_validate_valid_form_with_email(self): data = {