from open511.models import RoadEvent
from open511.utils.views import JSONView

class RoadEventListView(JSONView):

    def get(self, request):
        return [
            rdev.to_json_structure() for rdev in RoadEvent.objects.all()
        ]

list_roadevents = RoadEventListView.as_view()


from open511.models import RoadEvent
from open511.utils.views import JSONView

class RoadEventListView(JSONView):

    allow_jsonp = True

    def get(self, request):
        return [
            rdev.to_json_structure() for rdev in RoadEvent.objects.all()
        ]

list_roadevents = RoadEventListView.as_view()


Allow JSONP requests to the roadevents API
Allow JSONP requests to the roadevents API

  from open511.models import RoadEvent
  from open511.utils.views import JSONView
  
  class RoadEventListView(JSONView):
+ 
+     allow_jsonp = True
  
      def get(self, request):
          return [
              rdev.to_json_structure() for rdev in RoadEvent.objects.all()
          ]
  
  list_roadevents = RoadEventListView.as_view()
  
  
Allow JSONP requests to the roadevents API
## Code Before:
from open511.models import RoadEvent
from open511.utils.views import JSONView

class RoadEventListView(JSONView):

    def get(self, request):
        return [
            rdev.to_json_structure() for rdev in RoadEvent.objects.all()
        ]

list_roadevents = RoadEventListView.as_view()


## Instruction:
Allow JSONP requests to the roadevents API
## Code After:
from open511.models import RoadEvent
from open511.utils.views import JSONView

class RoadEventListView(JSONView):

    allow_jsonp = True

    def get(self, request):
        return [
            rdev.to_json_structure() for rdev in RoadEvent.objects.all()
        ]

list_roadevents = RoadEventListView.as_view()

