#18399 closed New feature (fixed)
Add a `for_concrete_model` kwarg to `ContentTypeManager.get_for_models?`
Reported by: | Simon Charette | Owned by: | Simon Charette |
---|---|---|---|
Component: | contrib.contenttypes | Version: | 1.4 |
Severity: | Normal | Keywords: | contenttypes proxy |
Cc: | charette.s@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
ContentTypeManager.get_for_models?
always return the ContentType
of the concrete model.
As highlighted in #17648 and #11154 there is cases that would benefit from the option of retrieving the ContentType
of proxy models.
However changing ContentTypeManager.get_for_model?
to return the ContentType
of proxy models would be backward incompatible.
I suggest adding a for_concrete_model=True
kwarg to ContentTypeManager.get_for_models?
which defaults to <=1.4 behaviour.
Pull request to come.
Note:
See TracTickets
for help on using tickets.
Looking at
get_for_models
implementation there doesn't seems to be way to add this flag while maintaining backward compatiblity sincemodels
are passed as*args
... We can rely on kwargs but maybe we could change signatures to getmodels
from*args[0]
saydef get_for_models(self, models, for_concrete_models=True)
and raise a deprecation warning if the old signature is used?