Skip to content

Instantly share code, notes, and snippets.

@javrasya
Created January 27, 2015 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javrasya/b4bec6ea490048a786c1 to your computer and use it in GitHub Desktop.
Save javrasya/b4bec6ea490048a786c1 to your computer and use it in GitHub Desktop.
from esefpy.web.rest.viewsets import BaseModelWithPaginationViewSet
from rest_framework import serializers
from rest_framework.reverse import reverse
from esefpy.reporting.models import ReportExecution, SUCCESS
from esefpy.reporting.serializers.report_execution import ReportExecutionSerializer
__author__ = 'ismail'
class ReportExecutionViewSet(BaseModelWithPaginationViewSet):
model = ReportExecution
serializer_class = ReportExecutionSerializer
access_uri = serializers.SerializerMethodField()
def get_queryset(self):
return ReportExecution.objects.all()
def get_access_uri(self, obj):
return reverse("report_downloading", args=[obj.pk]) if obj.status == SUCCESS else None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment