Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1559 closed defect (duplicate)

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

Reported by: jim-django@… Owned by: adrian
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@… 9 years ago.
Always process field defaults in django.core.meta.method_init

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by jim-django@…

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

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

  • Summary changed from Model instance __init__ ignores defaults if kwargs is empty to [patch]Model instance __init__ ignores defaults if kwargs is empty

comment:2 Changed 9 years ago by lukeplant

  • Resolution set to duplicate
  • Status changed from new to closed

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