Commits

Anonymous committed d0bd8ca

Improved valiadate decorator provides the validated form via the request

Comments (0)

Files changed (2)

         form = v_form(getattr(request, operation))
     
         if form.is_valid():
+            setattr( request, 'form', form )
             return f(self, request, *a, **kwa)
         else:
             raise FormValidationError(form)

tests/test_project/apps/testapp/handlers.py

 
     @validate(EchoForm, 'GET')
     def read(self, request):
-        return {'msg': request.GET['msg']}
+        return {'msg': request.form.cleaned_data['msg']}
 
 class ListFieldsHandler(BaseHandler):
     model = ListFieldsModel