Opened 4 years ago

Last modified 4 years ago

#29296 closed Bug

admindocs crash if a Feed is configured — at Version 1

Reported by: Paul Donohue Owned by: nobody
Component: contrib.admindocs Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Paul Donohue)

If a Feed ( is configured anywhere in the project, then /admin/doc/views/ ( crashes with AttributeError: 'GlobalFeed' object has no attribute '__qualname__'

The problem is that Feed is a callable object ( 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 (

In Django 1.11 and earlier, admindocs supported callable objects on Python 2 by falling back to view.__class__.__name__, but it appears that the Python 3 code in admindocs has not supported this since it was added in (

As a work-around, __qualname__ can be manually defined on Feed objects:

class MyFeed(Feed):
    def __init__(self):
        self.__qualname__ = '__call__'

Without knowing Django's opinion of the use of callable objects as views, I don't know the appropriate way to fix this: Should admindocs support callable objects as views, or should Feed not use a callable object as a view?

Change History (1)

comment:1 Changed 4 years ago by Paul Donohue

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top