#27709: ContentTypes.objects.get_for_models returns inconsistent results for proxy models --------------------------------------+------------------------------------ Reporter: Peter Inglesby | Owner: nobody Type: Bug | Status: new Component: contrib.contenttypes | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by Peter Inglesby): That fix doesn't work, and breaks an existing test. I've submitted a pull request that changes `get_for_models()` to use `get_for_model()`. This simplifies the code a lot, but means there will be one database query for each model that's not in the cache, rather than at most one database query per call to `get_for_models()`. Given that calls to `get_for_model()` are cached, I believe this is acceptable. I have an alternative fix that preserves the existing behaviour with respect to the number of database queries, but makes the code slightly harder to follow. -- Ticket URL: <https://code.djangoproject.com/ticket/27709#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.c4aed49c7aab21d97e3d027948c9d0b8%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.