i am learning django but gave web.py a try first.
while reading django’s documentation i found that in i need to check for the request type in each method.. like:
def myview():
if request.method == "POST":
#blah balh
#ke$ha (jst kiddn)
else:
#(balh)x2
can the web.py type classes be implemented in django like
class myView():
def GET(self):
#cool
def POST(self):
#double cool
it would be super cool
Yes, that’s possible with the new (as in Django 1.3) class-based views:
Usually, you don’t have to use the
Viewbase class, there are many views that are geared towards all kinds of cases, e.g.TemplateVieworFormView. Reinout van Rees has two excellent blog posts that go into the details:http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-walkthrough.html
http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html