Changes between Version 141 and Version 142 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
Dec 12, 2007, 8:48:43 PM (17 years ago)
Author:
jkocherhans
Comment:

Added note about #6162.

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v141 v142  
    4848 * [6833] Dec 2, 2007: [#Genericviewsemptydefaults Generic views' empty defaults]
    4949 * [6838] Dec. 3, 2007: [#MultipleObjectsReturnedexceptioninsteadofAssertionError MultipleObjectsReturned exception instead of AssertionError]
     50 * [6915] Dec 12, 2007 [#ModelFormsconstructornowmatchesForms ModelForm's constructor now matches Form's]
    5051
    5152== Database constraint names changed ==
     
    509510    ...
    510511}}}
     512
     513== !ModelForm's constructor now matches Form's ==
     514
     515{{{instance}}} was moved from the first argument in {{{ModelForm}}}'s {{{__init__}}} method to the last. Also, {{{ModelForm}}} will instantiate a new model object if you don't give it an instance. The model it generates is specified by the {{{ModelForm}}}'s inner {{{Meta}}} classes {{{model}}} attribute. See #6162 for details.
     516
     517Before:
     518{{{
     519#!python
     520# for add forms
     521obj = MyObj()
     522form = MyForm(obj)
     523
     524# for change forms
     525obj = MyObj.objects.get(pk=1)
     526form = MyForm(obj)
     527}}}
     528
     529After:
     530{{{
     531#!python
     532# for add forms
     533form = MyForm()
     534
     535# for change forms
     536obj = MyObj.objects.get(pk=1)
     537form = MyForm(instance=obj)
     538}}}
Back to Top