> Sometimes when calling save(), we know (for business reasons) that it
> must create a new object or raise an error. Similarly, in other cases,
> it either must update an existing object or raise an error.

I think discussion about this issue has been on this list before, last 
time someone suggested adding create() and update()...and keeping save() 
as an method calling these two, like:
---------8<----------------------------------------------------
class Model(...):
        def save(self, ...):
                if self.has_pk() and self.pk_exists():
                        self.update()
                else:
                        self.create()
        def update(): ...
        def create(): ...
---------------------------------------------------->8---------

So what is the big advantage of having an new parameter in save() like 
you suggested? With having create()/update() you can do similar things.

Additionally it would be possible to override only parts of the 
save()-logic in classes extending Model (for example when needing to 
calculate field-values on create, but not on insert...which is currently 
difficult).

And, of course, you would have no problems with naming the new parameter 
and difficulties in creating self-explaining possible values ("not 
must_create", rather than "must_not_create").

Just my 2 cents, David Danier

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to