On Mon, 2008-07-07 at 21:34 -0700, Ayaz Ahmed Khan wrote:
> I have a model with a CharField against which I have defined a
> validator, thus:
> 
> class Info(models.Model):
>     text = models.CharField(validator_list=[validators.isOnlyDigits])
> 
> When using a ModelForm of that Model in a view, Django fails to apply
> the validators.isOnlyDigits validation check.  If model is edited from
> admin, however, the specified extra validator is applied, and works.
> I don't know what I am doing wrong or missing out on.  Any clues would
> be really appreciated.
> 
> I am using the trunk build from svn of Django.  Thanks.

Django does not do any model field validation by default at the moment.
Admin does it using an old system (essentially, oldforms and Add- and
ChangeManipulators) that is being removed. We are adding more coherent
model field validation prior to 1.0. This is ticket #6845 and it's
actively work in progress (I reviewed it in detail over the weekend and
Honza is going to be working on the patch at the EuroPython sprint this
coming weekend).

For now, just do the validation manually in your model's save() method.
It's not ideal, but that's the way things are for the time being.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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