コード例 #1
0
 def subprojects(self, request, **kwargs):
     project = get_object_or_404(Project.objects.api(self.request.user),
                                 pk=kwargs['pk'])
     rels = project.subprojects.all()
     children = [rel.child for rel in rels]
     return Response(
         {'subprojects': ProjectSerializer(children, many=True).data})
コード例 #2
0
 def translations(self, request, **kwargs):
     project = get_object_or_404(Project.objects.api(self.request.user),
                                 pk=kwargs['pk'])
     queryset = project.translations.all()
     return Response(
         {'translations': ProjectSerializer(queryset, many=True).data})
コード例 #3
0
 def translations(self, request, pk):
     translations = self.get_object().translations.all()
     return Response({
         'translations': ProjectSerializer(translations, many=True).data
     })