Tuesday, March 19, 2013

Re: How can I get around required fields in admin?

On 20/03/2013 12:23am, Javier Guerra Giraldez wrote:
> On Tue, Mar 19, 2013 at 8:13 AM, frocco <farocco@gmail.com> wrote:
>> These required fields will not have data until a user checks out.
>
> then they're not required from a database point of view.
>
> regardless of that, they can be required on a form.
>
>

or you can program your own precise business logic in the clean() method
of the model including raising a ValidationError if info doesn't stack up.

https://docs.djangoproject.com/en/1.4/ref/models/instances/#django.db.models.Model.clean

Although you can do it in the form, IMHO the advantage of using the
clean() method in the model is keeping validation as close to the data
as possible - where it belongs!

Mike

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate