Ticket #8067: no_dicts_literal_on_doctests.diff

File no_dicts_literal_on_doctests.diff, 1.3 KB (added by Leo Soto M., 16 years ago)
  • tests/modeltests/model_formsets/models.py

    diff -r 232e190100e5 tests/modeltests/model_formsets/models.py
    a b  
    11from django.db import models
     2
     3try:
     4    sorted
     5except NameError:
     6    from django.utils.itercompat import sorted
    27
    38class Author(models.Model):
    49    name = models.CharField(max_length=100)
     
    212217
    213218>>> AuthorFormSet = modelformset_factory(Author, max_num=2)
    214219>>> formset = AuthorFormSet(queryset=qs)
    215 >>> formset.initial
    216 [{'id': 1, 'name': u'Charles Baudelaire'}, {'id': 3, 'name': u'Paul Verlaine'}]
     220>>> [sorted(x.items()) for x in formset.initial]
     221[[('id', 1), ('name', u'Charles Baudelaire')], [('id', 3), ('name', u'Paul Verlaine')]]
    217222
    218223>>> AuthorFormSet = modelformset_factory(Author, max_num=3)
    219224>>> formset = AuthorFormSet(queryset=qs)
    220 >>> formset.initial
    221 [{'id': 1, 'name': u'Charles Baudelaire'}, {'id': 3, 'name': u'Paul Verlaine'}, {'id': 2, 'name': u'Walt Whitman'}]
     225>>> [sorted(x.items()) for x in formset.initial]
     226[[('id', 1), ('name', u'Charles Baudelaire')], [('id', 3), ('name', u'Paul Verlaine')], [('id', 2), ('name', u'Walt Whitman')]]
     227
    222228
    223229# Inline Formsets ############################################################
    224230
Back to Top