Changes between Version 140 and Version 141 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
Dec 11, 2007, 11:06:29 PM (16 years ago)
Author:
Gary Wilson
Comment:

noted MultipleObjectsReturned change

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v140 v141  
    4747 * [6832] Dec 2, 2007: [#Settingsexceptiontypeschanged Settings exception types changed]
    4848 * [6833] Dec 2, 2007: [#Genericviewsemptydefaults Generic views' empty defaults]
     49 * [6838] Dec. 3, 2007: [#MultipleObjectsReturnedexceptioninsteadofAssertionError MultipleObjectsReturned exception instead of AssertionError]
    4950
    5051== Database constraint names changed ==
     
    485486
    486487In [6833] the {{{allow_empty}}} parameter to the {{{archive_index()}}} and {{{object_list()}}} generic views were changed to be True by default. So viewing a list of objects that is empty will not raise a 404 HTTP error. Things like date-based views still raise a 404 when there is nothing to view (by default), since viewing a non-existent date is usually going to be an error. See #685 for details.
     488
     489
     490== `MultipleObjectsReturned` exception instead of `AssertionError` ==
     491
     492In [6838], `QuerySet.get()` was changed to raise a `MultipleObjectsReturned` exception rather than an assertion error when multiple objects are returned.
     493
     494Before:
     495{{{
     496#!python
     497try:
     498    Model.objects.get(...)
     499except AssertionError:
     500    ...
     501}}}
     502
     503After:
     504{{{
     505#!python
     506try:
     507    Model.objects.get(...)
     508except Model.MultipleObjectsReturned:
     509    ...
     510}}}
Back to Top