diff --git a/examples/forms.py b/examples/forms.py index f0715d8..42ff4b1 100644 --- a/examples/forms.py +++ b/examples/forms.py @@ -22,6 +22,14 @@ class BookModelForm(BSModalModelForm): class Meta: model = Book exclude = ['timestamp'] + + + def clean(self): + data = super(BookModelForm, self).clean() + + if not all(value for value in data.values()): + raise forms.ValidationError("Form can't be empty.") + return data class CustomUserCreationForm(PopRequestMixin, CreateUpdateAjaxMixin, UserCreationForm): diff --git a/examples/templates/base.html b/examples/templates/base.html index 55c9547..f59b493 100644 --- a/examples/templates/base.html +++ b/examples/templates/base.html @@ -10,12 +10,13 @@ {% block stylesheets %} - + +