Package pyforms :: Package web :: Package django :: Module views |
[hide private]
[frames] | no frames]

# Source Code for Module pyforms.web.django.views

     1  from django.http import HttpResponse, HttpResponseServerError
     2  from django.shortcuts import render_to_response
     3  from django.template import RequestContext
     4  from django.conf import settings
     5  from django.views.decorators.cache                      import never_cache
     6  from django.views.decorators.csrf                       import csrf_exempt
     7  import json, simplejson, os
     8  from django.contrib.staticfiles.views import serve
     9
    10  @never_cache
    11  @csrf_exempt
    12 -def updateapplicationform(request, application):
    13          module                          = settings.PYFORMS_APPLICATIONS.createInstance(application)
    14          module.httpRequest      = request
    15
    16          module.loadSerializedForm( json.loads(request.body) )
    17
    18          result                          = module.serializeForm()
    19
    20          return HttpResponse(simplejson.dumps(result), "application/json")
    21
    22  @never_cache
    23  @csrf_exempt
    24 -def pyformsjs(request):
    25          filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pyforms.js')
    26          abspath = open(filename,'r')
    27          response = HttpResponse(content=abspath.read())
    28          response['Content-Type']= 'text/javascript'
    29          response['Content-Disposition'] = 'attachment; filename=pyforms.js'
    30          return response
    31