File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class DossierViewSet(viewsets.ReadOnlyModelViewSet):
2626 """
2727
2828 pagination_class = DefaultWebPagination
29- queryset = Dossier .objects .prefetch_related ( 'proposals__votes__representative' )
29+ queryset = Dossier .objects .all ( )
3030 serializer_class = DossierSerializer
3131
3232 filter_backends = (
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ class ProposalSerializer(serializers.HyperlinkedModelSerializer):
2323 class Meta :
2424 model = models .Proposal
2525 fields = (
26- 'id' ,
2726 'dossier' ,
2827 'title' ,
2928 'description' ,
@@ -40,29 +39,31 @@ class Meta:
4039class ProposalDetailSerializer (ProposalSerializer ):
4140 """ Proposal serializer that includes votes """
4241
42+ votes = VoteSerializer (many = True )
43+
44+ class Meta :
45+ model = models .Proposal
46+
4347
4448class DossierSerializer (serializers .HyperlinkedModelSerializer ):
4549 """ Base dossier serializer """
46- proposals = ProposalSerializer (many = True )
4750
4851 class Meta :
4952 model = models .Dossier
5053 fields = (
51- 'id' ,
5254 'title' ,
5355 'reference' ,
5456 'text' ,
5557 'link' ,
5658 'url' ,
57- 'proposals' ,
5859 )
5960
6061
6162class DossierDetailSerializer (DossierSerializer ):
6263 """
6364 Dossier serializer that includes proposals and votes.
6465 """
65- proposals = ProposalSerializer (many = True )
66+ proposals = ProposalDetailSerializer (many = True )
6667
6768 class Meta :
6869 model = models .Dossier
Original file line number Diff line number Diff line change @@ -31,5 +31,8 @@ def test_proposals(self):
3131 def test_vote (self ):
3232 self .functional_test (1 , '/api/votes/1/' )
3333
34+ def test_proposals (self ):
35+ self .functional_test (1 , '/api/proposals/' )
36+
3437 def test_votes (self ):
3538 self .functional_test (1 , '/api/votes/' )
You can’t perform that action at this time.
0 commit comments