Ticket #10150: model_to_sorted_dict.diff

File model_to_sorted_dict.diff, 500 bytes (added by Rob Hudson <treborhudson@…>, 15 years ago)

One line patch that replaces uses SortedDict in favor of {}

  • django/forms/models.py

    diff --git a/django/forms/models.py b/django/forms/models.py
    index 01bd912..f187183 100644
    a b def model_to_dict(instance, fields=None, exclude=None):  
    117117    # avoid a circular import
    118118    from django.db.models.fields.related import ManyToManyField, OneToOneField
    119119    opts = instance._meta
    120     data = {}
     120    data = SortedDict()
    121121    for f in opts.fields + opts.many_to_many:
    122122        if not f.editable:
    123123            continue
Back to Top