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})
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})
def translations(self, request, pk): translations = self.get_object().translations.all() return Response({ 'translations': ProjectSerializer(translations, many=True).data })