Merge branch 'master' of stigma.nowoczesnapolska.org.pl:platforma
[redakcja.git] / apps / api / handlers / manage_handlers.py
1 # -*- encoding: utf-8 -*-
2
3 __author__= "Ɓukasz Rekucki"
4 __date__ = "$2009-09-25 15:49:50$"
5 __doc__ = "Module documentation."
6
7 from piston.handler import BaseHandler, AnonymousBaseHandler
8
9 from explorer.models import PullRequest
10
11 class PullRequestListHandler(BaseHandler):
12     allowed_methods = ('GET',)
13
14     def read(self, request):
15         if request.user.has_perm('explorer.book.can_share'):
16             return PullRequest.objects.all()
17         else:
18             return PullRequest.objects.filter(commiter=request.user)
19
20
21 class PullRequestHandler(BaseHandler):
22     allowed_methods = ('GET',)
23
24     def read(self, request, prq_id):
25         return PullRequest.objects.get(id=prq_id)