Ticket #6453: 6453.diff

File 6453.diff, 886 bytes (added by SmileyChris, 8 years ago)
  • django/newforms/models.py

     
    160160    opts = instance._meta
    161161    data = {}
    162162    for f in opts.fields + opts.many_to_many:
    163         if not f.editable:
     163        if fields is not None:
     164            if not f.name in fields:
     165                continue
     166        elif not f.editable:
     167            # Only check if a field is not editable if a fields list was not
     168            # provided. Otherwise even non-editable fields should be included
     169            # in the returned dict since they were explicitly requested.
    164170            continue
    165         if fields and not f.name in fields:
    166             continue
    167171        if exclude and f.name in exclude:
    168172            continue
    169173        if isinstance(f, ManyToManyField):
Back to Top