diff --git a/fieldset_forms.py b/fieldset_forms.py index b02a541..8c05810 100644 --- a/fieldset_forms.py +++ b/fieldset_forms.py @@ -3,6 +3,9 @@ from django.utils import safestring from django.forms.forms import BoundField +class FieldsetError(Exception): + pass + class FieldsetForm(Form): """Extends BaseForm and adds fieldsets and the possibililty to use as_div. Inspired by WTForm.""" @@ -38,7 +41,7 @@ # create a field instance for the bound field field_instance = self.base_fields[field] except KeyError: - print "Could not resolve form field '%s'." % field + raise FieldsetError("Could not resolve form field '%s'." % field) # create a bound field containing all the necessary fields # from the model bound_field = BoundField(self, field_instance, field)