def formset_view(request):
 if (request.method == 'POST'):
  formset = TestFormSet(request.POST)
  if formset.is_valid():
   t = Template('Valid POST data.', name='Valid POST Template')
   c = Context()
  else:
   t = Template('Invalid POST data. {{ my_formset.errors }}', name='Invalid POST Template')
   c = Context({'my_formset': formset})
 else:
  formset = TestForm(request.GET)
  t = Template('Viewing base formset. {{ my_formset }}.', name='Formset GET Template')
  c = Context({'my_formset': formset})
 return HttpResponse(t.render(c))

def formset_view ( request ) : if ( request . method == 'POST' ) : formset = TestFormSet ( request . POST ) if formset . is_valid ( ) : t = Template ( 'Valid POST data.' , name = 'Valid POST Template' ) c = Context ( ) else : t = Template ( 'Invalid POST data. {{ my_formset.errors }}' , name = 'Invalid POST Template' ) c = Context ( { 'my_formset' : formset } ) else : formset = TestForm ( request . GET ) t = Template ( 'Viewing base formset. {{ my_formset }}.' , name = 'Formset GET Template' ) c = Context ( { 'my_formset' : formset } ) return HttpResponse ( t . render ( c ) )
a view that tests a simple formset .