* eat <[EMAIL PROTECTED]> [2008-03-29 05:24 -0700]: > > How to distinct in save() method of the model if the save operation > will be update or insert. > > I want to know it BEFORE doing the save(). > I want to know it WITHOUT doing a select to a database. > > THe reason for that : i want to check the database conditions for the > insert to initiate. > > Currently i can only imagine i could do my own function save_insert() > save_update() and initiate them when needed , isnt there any simpler > method??
Have you looked at this: http://www.djangoproject.com/documentation/db-api/#how-django-knows-to-update-vs-insert It seems that if the object's primary key is not set, it'll be an insert; if it is set, according to the docs, you'll have to chack against the database. --- Amit > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---