#35682: `BaseListView` class calling non existing `render_to_response()` method
-------------------------------------+-------------------------------------
     Reporter:  Jesús Leganés-       |                     Type:  Bug
  Combarro                           |                Component:  Generic
       Status:  new                  |  views
      Version:  5.1                  |                 Severity:  Normal
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 At
 
https://github.com/django/django/blob/a57596e443ecb67140e1a9fc0f0e87446b2d0174/django/views/generic/list.py#L175,
 `BaseListView.get()` method is calling to
 `self.render_to_response(context)` method. Fact is, I have searched in all
 the `BaseListView` ancestor classes (`MultipleObjectMixin`, `ContextMixin`
 and `View`) and was not able to find any reference to the
 `render_to_response()` method, both in the documentation or the code
 itself. The only place I have been able to find it implemented is in the
 `TemplateResponseMixin` class, that's templates oriented, and it's only
 related to `BaseListView` because both classes are ancestors of
 `ListView`.

 In its current state, using `BaseListView` class without overriding the
 `BaseListView.get()` method (that already implements a proper handler for
 HTTP `GET` method, so overriding would not be needed) would crash because
 `render_to_response()` method can't be found. One solution would be to add
 `render_to_response()` as an abstract method, and add it on the
 documentation forcing to be implemented in a child class, but
 `render_to_response()` feels to be too much related to templates, and was
 not able to find any other rendering related function in `View` or other
 ancestor class of `BaseListView`... Another maybe better solution would be
 to move `BaseListView.get()` method to `ListView.get()`, left ing
 `BaseListView` empty the same way that `ListView` currently is, or just
 with a `get_context_data()` method to include the checking if list is
 empty like a validation, but that last ones would be backward
 incompatibles... Is there any other better solution for this?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35682>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191559cc921-c02f92a1-42e8-469a-bec0-06d37f9140ec-000000%40eu-central-1.amazonses.com.

Reply via email to