On Mon, Nov 17, 2008 at 10:00 PM, TeenSpirit83
<[EMAIL PROTECTED]> wrote:
>
> I'm writing an app with some italian zip and vat number fields and
> also a province select field
> can i force the admin class to validate the fields like
> class it.forms.ITVatNumberField
> class it.forms.ITZipCodeField
> class it.forms.ITProvinceSelect
> ??

There was a thread in the django-es mailing list a while ago about a
similar requirement, the OP needed being able to replace a generic
model-derived field in the admin app forms with a localflavor form field
that uses the same database column type, this would have the same effect
you are looking for: having the specific validation being aplied to it:

http://groups.google.com/group/django-es/browse_thread/thread/ead0c017040a8cd4/56dc130cbe269b9d?hl=en&lnk=gst

What we came up with was:

http://dpaste.com/hold/73468/

that uses the formfield_for_dbfield() ModelAdmin method.

The condition in line 16 can (and in fact should) be made more
specific to include the name
of the field.

There could be another way though, take a look at this documentation section:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin

Regards,

--
 Ramiro Morales

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