Oh and the NewformsHOWTO doc says:
"How do I add custom validation?"
"""One option is to override form_add() and form_change() in
ModelAdmin and provide a custom form that does the validation."""
There doesn't seem to be the from_add() and form_change() methods
available in ModelAdmin, unless I'm looking in a wrong place or the
latest repository version is newer then the online doc itself.
-al
On Apr 30, 4:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I have a below class as an Admin option for the newform-admin.
>
> class JobInfoOptions(admin.ModelAdmin):
> def add_view(self, request):
> if request.method == "POST" and not request.POST['job_title']
> and request.POST['status'] != "I":
> raise forms.ValidationError('Status can only be set to
> "Inactive" if Job Title is not provided.')
> return super(MyModelOptions, self).add_view(request)
>
> How do I add the error message to the errors list? (errors.add('Status
> can only be set to "Inactive" if Job Title is not provided.',
> statusFieldReference))
> Or am I doing this incorrectly?
>
> -Alen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---