Thursday, May 26, 2011

Re: Django Model custom save

On Thu, 2011-05-26 at 04:36 -0700, Юлиян Попов wrote:
> I have a model and a form which is used to insert new rows in
> database. For
> every inserted (or edited) row I need to make a database lock and
> check if
> edited row have a conflict with rows that are already in the database.

why do you need to do this? Database design should make sure that every
row is unique - which is usually done using unique_together in the model

>
> Where is the right place for this checks? In form validation? In a
> view or
> in the model?

if not enforced by the database design the best place is in model
validation.
--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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

No comments:

Post a Comment