{{{
match = resolve(url_split)
for cl in match.func.__closure__:
if hasattr(cl.cell_contents, 'http_method_names'):
view_class = cl.cell_contents
# etc
if hasattr(cl.cell_contents, 'admin_site'):
admin = cl.cell_contents
if not admin.has_change_permission(etc):
etc
}}}
It would be great if we could keep a reference to the original view class
in these cases.
--
Ticket URL: <https://code.djangoproject.com/ticket/24055>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0
Comment:
https://github.com/django/django/pull/3797
--
Ticket URL: <https://code.djangoproject.com/ticket/24055#comment:1>
* needs_docs: 0 => 1
* stage: Unreviewed => Accepted
Comment:
I agree it'd be nice to enable retrieving the actual class, we already
preserve `__name__`, `__doc__`, etc. we might as well preserve the class
itself.
I was worried that decorators like `login_required` would wipe these
anyway and that it may be too fragile as an API, but apparently it doesn't
happen thanks to `functools.wraps()` preserving `__dict__`.
--
Ticket URL: <https://code.djangoproject.com/ticket/24055#comment:2>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"a420f83e7d2e446ca01ef7c13d30c2ef3e975e5c"]:
{{{
#!CommitTicketReference repository=""
revision="a420f83e7d2e446ca01ef7c13d30c2ef3e975e5c"
Fixed #24055 -- Keep reference to view class for resolve()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24055#comment:3>