Esempio n. 1
0
 def post(self, request):
     form = BasicForm(request.POST)
     if not form.is_valid():
         ctx = {'form': form}
         return render(request, 'form/form.html', ctx)
     # save data
     return redirect('/form/success')
Esempio n. 2
0
 def post(self, request):
     form = BasicForm(request.POST)
     if not form.is_valid():
         ctx = {'form': form}
         return render(request, 'form/form.html', ctx)
     # If there are no errors, we would save the data
     x = reverse('form:success')
     return redirect(x)
Esempio n. 3
0
 def post(self, request):
     form = BasicForm(request.POST)
     if not form.is_valid():
         ctx = {'form': form}
         return render(request, 'form/form.html', ctx)
     # Save the Data
     # Look up the url for the next view in urls.py
     x = reverse('form:success')
     return redirect(x)
Esempio n. 4
0
    def post(self, request) :
        form = BasicForm(request.POST)
        if not form.is_valid() :
            ctx = {'form' : form}
            return render(request, 'form.html', ctx)

        js = json.dumps(request.POST, sort_keys=True, indent=4)        
        ctx = {'title': 'request.POST', 'dump': js}
        return render(request, 'formdump.html', ctx)