Skip to content

Conversation

@mmirate
Copy link

@mmirate mmirate commented Jan 10, 2025

Fixes #914. Thank you for your consideration.

@limugob
Copy link

limugob commented Jun 23, 2025

The normal implementation of ListView fills beside the variable object_list⁣ the model_name_list variable with the same data. But this PR omits the model_name_list variable.

@mmirate
Copy link
Author

mmirate commented Jun 26, 2025

The normal implementation of ListView fills beside the variable object_list⁣ the model_name_list variable with the same data. But this PR omits the model_name_list variable.

I'm trying to understand this, but grep is being uncooperative. Are you perchance referring to django.views.generic.list.MultipleObjectTemplateResponseMixin.get_template_names? Else, can you point me concretely to what you're referring to in Django?

@limugob
Copy link

limugob commented Jul 1, 2025

I mean, if I have a ListView for the model Dog then in
https://github.com/django/django/blob/192bc7a7be92e20cc250907fb4083df689715679/django/views/generic/list.py#L145
the template variable dogs_list is filled (together with objects_list). But with this PR only the objects_list variable is filled properly.

from django.core.exceptions import ImproperlyConfigured
from django.views.generic.list import ListView
from django.views.generic.list import (
MultipleObjectMixin as ConfoundingMultipleObjectMixin,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for the alias? Can't we just do from django.views.generic.list import ListView, MultipleObjectMixin?

similar, as presumably ListView.get_context_data is meant to fetch the
same data as this function will fetch directly.
"""
context = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are multiple overrides of get_context_data, this could skip more than just the MultipleObjectMixin.get_context_data that this PR tries to skip.

I feel as if the current implementation could have unintended breaking side-effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL queries are duplicated when mixing in with MultipleObjectMixin-based views e.g. django-filter

4 participants