Opened 15 years ago
Closed 15 years ago
#12338 closed (invalid)
"Overriding predefined model methods": use *args, **kwargs in code sample
Reported by: | Daniel Hahler | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The "Overriding predefined model methods" section in the models doc provides sample code to override save, and I think that the code should use "*args, kwargs" so that your own implementation is future proof.
I'm attaching a patch for docs/topics/db/models.txt
Attachments (1)
Change History (3)
by , 15 years ago
Attachment: | django-models-doc.diff added |
---|
comment:1 by , 15 years ago
I'm not sure that you want to pass through all args and kwargs. If I pass anything other than force_insert or force_update to my function then I will get TypeError (unexpected keyword argument) when that argument is passed into the model's save method. The model's save method doesn't accept kwargs, so passing that to it is asking for trouble.
Just my 2 cents.
Alex
comment:2 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I'm going to set this invalid since I think it won't work. Feel free to set it back if I am wrong.
Patch against trunk