On Mon, Feb 2, 2009 at 7:21 PM, wotaskd <[email protected]> wrote:
>
> Hello everyone, a quick (and I guess easy) one:
>
> Is there any way, on the admin site, to make a field for a model
> mandatory, if another one is blank and vice-versa?

Yeap, you need to write your own form class, subclass clean() method
do your checks and return cleaned_data or raise an exception.

Take a look to:
http://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other

Also (in advance to your next question) take a look to:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin

M

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to