Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#1559 closed defect (duplicate)

[patch]Model instance __init__ ignores defaults if kwargs is empty

Reported by: jim-django@… Owned by: Adrian Holovaty
Component: Metasystem Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently, django.core.meta.method_init does not fill in default values if no keyword arguments are passed. This makes it impossible to create instances of models using defaults for all fields. See http://django.pastebin.com/630262 for an example.

Attached is a trivial patch that always goes through fields setting defaults if no kwarg is specified.

Attachments (1)

always_process_defaults.diff (2.9 KB) - added by jim-django@… 11 years ago.
Always process field defaults in django.core.meta.method_init

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by jim-django@…

Always process field defaults in django.core.meta.method_init

comment:1 Changed 11 years ago by jim-django@…

Summary: Model instance __init__ ignores defaults if kwargs is empty[patch]Model instance __init__ ignores defaults if kwargs is empty

comment:2 Changed 11 years ago by Luke Plant

Resolution: duplicate
Status: newclosed

This is a duplicate of #1705 (OK, the other way around actually), but fixed now.

Note: See TracTickets for help on using tickets.
Back to Top