Exemplo n.º 1
0
 def get_object(self, queryset=None):
     try:
         obj = Round.objects.get(
             tournament=self.request.user.profile.tournament,
             order=self.kwargs['round_nr']).pdf_ranking
         if not obj.status in [Pdf.SUCCESS, Pdf.UPLOAD]:
             raise Pdf.DoesNotExist("File not yet available")
         return obj.file
     except:
         raise Pdf.DoesNotExist("File does not exist")
Exemplo n.º 2
0
 def get_object(self, queryset=None):
     try:
         obj = Fight.objects.get(
             round__tournament=self.request.user.profile.tournament,
             id=self.kwargs['fight_id']).pdf_result
         if not obj.status in [Pdf.SUCCESS, Pdf.UPLOAD]:
             raise Pdf.DoesNotExist("File not yet available")
         return obj.file
     except:
         raise Pdf.DoesNotExist("File does not exist")
Exemplo n.º 3
0
 def get_object(self, queryset=None):
     try:
         acc = get_object_or_404(Account,
                                 pk=self.kwargs['a_id'],
                                 owners=self.request.user.profile.active)
         obj = acc.pdf_set.get(id=self.kwargs['pdf_id']).file
         return obj
     except:
         raise Pdf.DoesNotExist("File does not exist")
Exemplo n.º 4
0
    def get_object(self, queryset=None):

        try:
            tournament = get_object_or_404(Tournament,
                                           slug=self.kwargs['t_slug'])
            ro = get_object_or_404(Round,
                                   order=self.kwargs['round_nr'],
                                   tournament=tournament)
            room = get_object_or_404(Room,
                                     slug=self.kwargs['room_slug'],
                                     tournament=tournament)

            auth = _view_grades_perm(self.request, tournament)
            if type(auth) != bool:
                raise Pdf.DoesNotExist("File does not exist")

            fight = ro.fight_set.get(room=room)

            obj = fight.pdf_partial_grades
            if not obj.status in [Pdf.SUCCESS, Pdf.UPLOAD]:
                raise Pdf.DoesNotExist("File not yet available")
            return obj.file
        except:
            raise Pdf.DoesNotExist("File does not exist")