Opened 19 years ago

Closed 19 years ago

Last modified 18 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: 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)

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

Download all attachments as: .zip

Change History (3)

by jim-django@…, 19 years ago

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

comment:1 by jim-django@…, 19 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 Luke Plant, 19 years ago

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