#1559 closed defect (duplicate)
[patch]Model instance __init__ ignores defaults if kwargs is empty
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | Metasystem | Version: | dev |
| Severity: | normal | 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
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)
Change History (3)
by , 20 years ago
| Attachment: | always_process_defaults.diff added |
|---|
comment:1 by , 20 years ago
| Summary: | Model instance __init__ ignores defaults if kwargs is empty → [patch]Model instance __init__ ignores defaults if kwargs is empty |
|---|
comment:2 by , 20 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
This is a duplicate of #1705 (OK, the other way around actually), but fixed now.
Note:
See TracTickets
for help on using tickets.
Always process field defaults in django.core.meta.method_init