#26660: Remove ugly .as_view() requeriment
-------------------------------+--------------------
Reporter: john-bonachon | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (URLs) | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Let's take this ''urls.py'' as an example,
{{{
from django.conf.urls import url
from . import views
app_name = 'polls'
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>[0-9]+)/results/$', views.ResultsView.as_view(),
name='results'),
url(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, name='vote'),
]
}}}
Is there any elegant "trick" to avoid calling the method .as_view() and
make the Class View callable? I'm not sure if using {{{__call__}}} magic
function on django.views.generic.View would help on this.
It may have sense to make the developer remember that you must send a
callable that will receive an HttpRequest plus the regex arguments,
however url() is also accepting a list or tuple for include() processing,
so I wonder if we could also just send the Class View.
--
Ticket URL: <https://code.djangoproject.com/ticket/26660>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.764320d8018eba16424d8765dc7215b0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.