Tag: Django

Why do Django views need an as_view() method?

tim March 14, 2018 No Comments Libraries

One thing I’ve sometimes wondered about when using Django: Why do view objects need to be constructed in a special way? For those of you who haven’t used Django, a typical URL mapping scheme looks like this: urlpatterns = [ url(r’^login/$’, views.LoginView.as_view(), name=’login’), url(r’^logout/$’, views.LogoutView.as_view(), name=’logout’), # … ] This maps URLs to view classes […]

Page 1 of 1