Hello,

I'm programming a database front end. In many cases I want to
constrain the data written to the database. Therefore I implement some
checks either through real database constraints or trough some logic
in the model, so it will throw an exception when the constraints are
not met.

e.g.: unique constraint on a database column.

Now, when I write my form validation, I have to implement the same
logic again, since form validation takes place before a save() is even
considered. Like this:

>>> if form.is_valid():
>>>    form.save()

Is there a better way to do it? Is there a good way to avoid this
duplicate logic?

Regards
  Roman

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to