def post_view(request):
 if (request.method == 'POST'):
  if request.POST:
   t = Template('Data received: {{ data }} is the value.', name='POST Template')
   c = Context({'data': request.POST['value']})
  else:
   t = Template('Viewing POST page.', name='Empty POST Template')
   c = Context()
 else:
  t = Template('Viewing GET page.', name='Empty GET Template')
  c = Context()
 return HttpResponse(t.render(c))

def post_view ( request ) : if ( request . method == 'POST' ) : if request . POST : t = Template ( 'Data received: {{ data }} is the value.' , name = 'POST Template' ) c = Context ( { 'data' : request . POST [ 'value' ] } ) else : t = Template ( 'Viewing POST page.' , name = 'Empty POST Template' ) c = Context ( ) else : t = Template ( 'Viewing GET page.' , name = 'Empty GET Template' ) c = Context ( ) return HttpResponse ( t . render ( c ) )
a view that expects a post .