#19005: Allow class based views to be included in urls.py by name as a string
-----------------------------+--------------------
Reporter: tanderegg | Owner: nobody
Type: New feature | Status: new
Component: Core (URLs) | Version: 1.4
Severity: Normal | Keywords: cbv
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------
Class based views currently have to be imported into urls.py and then
added to urlpatterns using ClassBasedView.as_view().
It would be relatively trivial, it seems, to add functionality to the
method 'get_callable' in django.core.urlresolvers that uses
inspect.isclass to determine if the lookup_view refers to a class, and if
so set lookup_view = lookup_view.as_view(), throwing an exception if
lookup_view is a class but the method as_view() doesn't exist.
This would help cleanup urls.py when using class based views, and be more
consistent with how function based views are handled. Is there any reason
not to do this? If people support this I will submit a patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/19005>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.