Changes between Version 2 and Version 3 of Ticket #29296


Ignore:
Timestamp:
Apr 6, 2018, 6:17:07 PM (6 years ago)
Author:
Paul Donohue
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29296 – Description

    v2 v3  
    33The problem is that Feed is a callable object (https://github.com/django/django/blob/master/django/contrib/syndication/views.py#L34) and the documentation uses that class directly as a View (`path('latest/feed/', LatestEntriesFeed()),`), but admindocs assumes that all views are functions and it does not work properly with a callable object (https://github.com/django/django/blob/master/django/contrib/admindocs/views.py#L130).
    44
    5 In Django 1.11 and earlier, admindocs supported callable objects on Python 2 because it used `view.__name__` instead of `view.__qualname__`, but it appears that the Python 3 code in admindocs has not supported this since it was added in https://github.com/django/django/commit/ae0f55eb491255217d6df31296ec8102007224a6 (https://code.djangoproject.com/ticket/27018).
     5In Django 1.11 and earlier, admindocs supported callable objects on Python 2 because it fell back to `view.__class__.__name__`, but it appears that the Python 3 code in admindocs has not supported this since it was added in https://github.com/django/django/commit/ae0f55eb491255217d6df31296ec8102007224a6 (https://code.djangoproject.com/ticket/27018).
    66
    77As a work-around, `__qualname__` can be manually defined on Feed objects:
     
    1111    def __init__(self):
    1212        super().__init__()
    13         self.__qualname__ = '__call__'
     13        self.__qualname__ = self.__class__.__name__
    1414}}}
    1515
Back to Top