Ticket #8071: r8520-validate-username-2.patch

File r8520-validate-username-2.patch, 1.0 KB (added by kratorius, 7 years ago)

Fixed previous patch that wasn't checking for Meta (and tests failed)

  • django/forms/models.py

     
    419419    # let the formset handle object deletion by default
    420420
    421421    if exclude is not None:
     422        if type(exclude) == str:
     423            exclude = [exclude]
     424        else:
     425            exclude = list(exclude)
     426
    422427        exclude.append(fk.name)
    423428    else:
    424429        exclude = [fk.name]
  • django/contrib/admin/options.py

     
    774774            "extra": self.extra,
    775775            "max_num": self.max_num,
    776776        }
     777
     778        if hasattr(self.form, "Meta") and hasattr(self.form.Meta, "exclude"):
     779            defaults.update({ "exclude": self.form.Meta.exclude })
     780
    777781        defaults.update(kwargs)
    778782        return inlineformset_factory(self.parent_model, self.model, **defaults)
    779783
Back to Top