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

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -