Created
January 27, 2015 07:11
-
-
Save javrasya/b4bec6ea490048a786c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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