save(self, force_insert=False, force_update=False) or
save(self, force_insert=False, force_update=False, **kwargs)
# whatever
super(Xyz, self).save(force_insert, force_update) or
super(Xyz, self).save(force_insert, force_update, **kwargs)
and
save(self, *arg, **kwargs)
# whatever
super(Xyz, self).save(*args, **kwargs)
I see the former in a fair bit of django example code around the place
and the latter in the docs here
https://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods
Thanks for any insights
Mike
Mike
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/zk3ttVQDbSgJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
Thanks .. the "using" kw hadn't occurred to me but I don't know of any
others. I'm happy now. I figure the force_* kwargs were probably the
only ones then and it wasn't too difficult for example code to mention
them. I prefer the *args, **kwargs version anyway. It hides the gory
detail from me.
Cheers
Mike
On 16/08/2011 5:23pm, Yaþar Arabacý wrote:
> Absence of **kwargs would cause problems if for example save method is
> called with "using" keyword argument. You could either list all the
> available keyword arguments or use **kwargs.
>
> By the way, is there any other kwarg for save?
>
> 2011/8/16 Mike Dewhirst <mi...@dewhirst.com.au
> <mailto:mi...@dewhirst.com.au>>
>
> When using save() in a model, what is the difference between ...
>
> save(self, force_insert=False, force_update=False) or
> save(self, force_insert=False, force_update=False, **kwargs)
> # whatever
> super(Xyz, self).save(force_insert, force_update) or
> super(Xyz, self).save(force_insert, force_update, **kwargs)
>
> and
>
> save(self, *arg, **kwargs)
> # whatever
> super(Xyz, self).save(*args, **kwargs)
>
> I see the former in a fair bit of django example code around the
> place and the latter in the docs here
>
> https://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods
>
> Thanks for any insights
>
> Mike
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com
> <mailto:django-users%2Bunsu...@googlegroups.com>.