Hello,

I have a situation where I would like to do some validation on a many-
to-many field in a model before it is saved. When the validation fails
the model should not be saved and result in an appropriate error.
However to be able to do anything with a many-to-many field the
primary key of the model should be available, therefore it seems that
the model should be saved first.

In Forms there is the option to save with commit=False, but I could
not find anything similar to this for the Models save function.
Also, using a pre-save signal would not work, because the model is not
saved yet. A post-save signal doesn't work either because then the
model gets saved even in the cases that it shouldn't. Rewriting the
save function would be the best option, but because I cannot 'pre'-
save with commit=False this doesn't work either.

Could anyone tell me if there is such a function to achieve what I
need or if there is a better way of doing this?
Thanks very much!
Heleen

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