django - How to write a view that that responds with the http request that the function is passed? -
urls.py
from django.conf.urls import patterns, url testform import views urlpatterns = patterns('', url(r'^$', views.testhandler), )
views.py
from django.http import httpresponse def testhandler(request): #return httpresponse(request)
in views.py how return request testhandler passed?
i have admit weirdest question have ever seen on so. anyway can view return request
this:
from django.http import httpresponse def testhandler(request): return httpresponse(request.__str__())
if want see bit nicer in browser, can try:
from django.http import httpresponse def testhandler(request): return httpresponse('<br />'.join(request.__str__().split('\n'))) # convert \n <br />
Comments
Post a Comment