Specifically, for a model I have the following: -
def clean(self):
from django.core.exceptions import ValidationError
if self.is_current and self.to_date is not None:
raise ValidationError("Current ongoing process may not
have a 'To' date.")
if not self.is_current and self.to_date is None:
raise ValidationError("'To' date may not be left blank if
this is not a current ongoing process.")
I might as well mention that I am using inlineformset_factory for this
model.
I am getting the following traceback: -
Traceback (most recent call last):
File "/filepath/django/core/handlers/base.py", line 101, in
get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/filepath/django/utils/decorators.py", line 36, in __call__
return self.decorator(self.func)(*args, **kwargs)
File "/filepath/django/contrib/auth/decorators.py", line 24, in
_wrapped_view
return view_func(request, *args, **kwargs)
File "/filepath/django/db/transaction.py", line 295, in
_commit_on_success
res = func(*args, **kw)
File "/filepath2/project/app/views/modelwithinlines.py", line 398,
in edit_model
if form.is_valid() and e_formset.is_valid() and p_formset.is_valid
() and x_formset.is_valid() and l_formset.is_valid():
File "/filepath/django/forms/formsets.py", line 256, in is_valid
if bool(self.errors[i]):
File "/filepath/django/forms/formsets.py", line 230, in _get_errors
self.full_clean()
File "/filepath/django/forms/formsets.py", line 269, in full_clean
self._errors.append(form.errors)
File "/filepath/django/forms/forms.py", line 111, in _get_errors
self.full_clean()
File "/filepath/django/forms/forms.py", line 267, in full_clean
self._clean_form()
File "/filepath/django/forms/models.py", line 320, in _clean_form
self._update_errors(e.message_dict)
AttributeError: 'ValidationError' object has no attribute
'message_dict'
Any ideas? What do I need to do regarding the message_dict? What am I
overlooking?
Regards.
I am trying out the new model validation feature in svn trunk, but I
doubt I am doing this right.
Specifically, for a model I have the following: -
[snip]
AttributeError: 'ValidationError' object has no attribute
'message_dict'
Any ideas? What do I need to do regarding the message_dict? What am I
overlooking?