Hi,
Supose that I have a model with a from and to date:

class Foo (models.Model):
    from_date = models.DateField()
    to_date = models.DateField()

What is the correct way to ensure that from_date is always before
to_date?
For now, I'm using only the admin site.

One way, may be, is to use custom validation to the admin, like
suggest in 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin.

But i think that is better to have a method to validate, inside model
logic, as suggested in an old thread
http://groups.google.com/group/django-users/browse_thread/thread/58c20c72f8b8725a/ec2a26c6118183fd?lnk=gst&q=validation#ec2a26c6118183fd

The latter one, does not work for me.... i dont know what i'm doing
wrong, i got an error msg :
'Foo' object has no attribute 'cleaned_data'

Regards,
Mario.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to