Commit 4e1f1011 authored by Nicolas Joyard's avatar Nicolas Joyard

Force default ordering for API

parent 45484bb6
......@@ -49,7 +49,7 @@ class RepresentativeViewSet(viewsets.ReadOnlyModelViewSet):
"""
API endpoint that allows representatives to be viewed.
"""
queryset = Representative.objects.all()
queryset = Representative.objects.order_by('slug')
filter_backends = (
filters.DjangoFilterBackend,
filters.SearchFilter,
......@@ -68,7 +68,6 @@ class RepresentativeViewSet(viewsets.ReadOnlyModelViewSet):
'birth_date': ['exact', 'gte', 'lte'],
}
search_fields = ('first_name', 'last_name', 'slug')
ordering_fields = ('id', 'birth_date', 'last_name', 'full_name')
pagination_class = DefaultWebPagination
def get_queryset(self):
......@@ -102,7 +101,8 @@ class MandateViewSet(viewsets.ReadOnlyModelViewSet):
API endpoint that allows mandates to be viewed.
"""
pagination_class = DefaultWebPagination
queryset = Mandate.objects.select_related('representative')
queryset = Mandate.objects.select_related('representative') \
.order_by('representative_id', 'id')
serializer_class = MandateSerializer
filter_backends = (
......@@ -121,7 +121,7 @@ class MandateViewSet(viewsets.ReadOnlyModelViewSet):
class ConstituencyViewSet(viewsets.ReadOnlyModelViewSet):
pagination_class = DefaultWebPagination
queryset = Constituency.objects.all()
queryset = Constituency.objects.order_by('id')
serializer_class = ConstituencySerializer
filter_backends = (
......@@ -131,7 +131,7 @@ class ConstituencyViewSet(viewsets.ReadOnlyModelViewSet):
class GroupViewSet(viewsets.ReadOnlyModelViewSet):
pagination_class = DefaultWebPagination
queryset = Group.objects.all()
queryset = Group.objects.order_by('id')
serializer_class = GroupSerializer
filter_backends = (
......@@ -141,7 +141,7 @@ class GroupViewSet(viewsets.ReadOnlyModelViewSet):
class ChamberViewSet(viewsets.ReadOnlyModelViewSet):
pagination_class = DefaultWebPagination
queryset = Chamber.objects.all()
queryset = Chamber.objects.order_by('id')
serializer_class = ChamberSerializer
filter_backends = (
......@@ -151,7 +151,7 @@ class ChamberViewSet(viewsets.ReadOnlyModelViewSet):
class CountryViewSet(viewsets.ReadOnlyModelViewSet):
pagination_class = DefaultWebPagination
queryset = Country.objects.all()
queryset = Country.objects.order_by('id')
serializer_class = CountrySerializer
filter_backends = (
......
[{"id":6,"url":"http://testserver/api/groups/6/?format=json","name":"Austria","abbreviation":"AT","kind":"country"},{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},{"id":1,"url":"http://testserver/api/groups/1/?format=json","name":"Committee on Employment and Social Affairs","abbreviation":"EMPL","kind":"committee"},{"id":9,"url":"http://testserver/api/groups/9/?format=json","name":"Committee on Industry, Research and Energy","abbreviation":"ITRE","kind":"committee"},{"id":7,"url":"http://testserver/api/groups/7/?format=json","name":"Conference of Delegation Chairs","abbreviation":"","kind":"organization"},{"id":12,"url":"http://testserver/api/groups/12/?format=json","name":"Delegation for relations with Australia and New Zealand","abbreviation":"","kind":"delegation"},{"id":11,"url":"http://testserver/api/groups/11/?format=json","name":"Delegation for relations with Bosnia and Herzegovina, and Kosovo","abbreviation":"","kind":"delegation"},{"id":3,"url":"http://testserver/api/groups/3/?format=json","name":"Delegation for relations with the Member States of ASEAN, South-east Asia and the Republic of Korea","abbreviation":"","kind":"delegation"},{"id":2,"url":"http://testserver/api/groups/2/?format=json","name":"Delegation for relations with the countries of Southeast Asia and the Association of Southeast Asian Nations (ASEAN)","abbreviation":"","kind":"delegation"},{"id":10,"url":"http://testserver/api/groups/10/?format=json","name":"Delegation to the EU-Serbia Stabilisation and Association Parliamentary Committee","abbreviation":"","kind":"delegation"},{"id":4,"url":"http://testserver/api/groups/4/?format=json","name":"Group of the European People's Party (Christian Democrats) and European Democrats","abbreviation":"PPE-DE","kind":"group"},{"id":5,"url":"http://testserver/api/groups/5/?format=json","name":"Group of the European People's Party (Christian-Democratic Group)","abbreviation":"EPP","kind":"group"},{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"}]
\ No newline at end of file
[{"id":1,"url":"http://testserver/api/groups/1/?format=json","name":"Committee on Employment and Social Affairs","abbreviation":"EMPL","kind":"committee"},{"id":2,"url":"http://testserver/api/groups/2/?format=json","name":"Delegation for relations with the countries of Southeast Asia and the Association of Southeast Asian Nations (ASEAN)","abbreviation":"","kind":"delegation"},{"id":3,"url":"http://testserver/api/groups/3/?format=json","name":"Delegation for relations with the Member States of ASEAN, South-east Asia and the Republic of Korea","abbreviation":"","kind":"delegation"},{"id":4,"url":"http://testserver/api/groups/4/?format=json","name":"Group of the European People's Party (Christian Democrats) and European Democrats","abbreviation":"PPE-DE","kind":"group"},{"id":5,"url":"http://testserver/api/groups/5/?format=json","name":"Group of the European People's Party (Christian-Democratic Group)","abbreviation":"EPP","kind":"group"},{"id":6,"url":"http://testserver/api/groups/6/?format=json","name":"Austria","abbreviation":"AT","kind":"country"},{"id":7,"url":"http://testserver/api/groups/7/?format=json","name":"Conference of Delegation Chairs","abbreviation":"","kind":"organization"},{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},{"id":9,"url":"http://testserver/api/groups/9/?format=json","name":"Committee on Industry, Research and Energy","abbreviation":"ITRE","kind":"committee"},{"id":10,"url":"http://testserver/api/groups/10/?format=json","name":"Delegation to the EU-Serbia Stabilisation and Association Parliamentary Committee","abbreviation":"","kind":"delegation"},{"id":11,"url":"http://testserver/api/groups/11/?format=json","name":"Delegation for relations with Bosnia and Herzegovina, and Kosovo","abbreviation":"","kind":"delegation"},{"id":12,"url":"http://testserver/api/groups/12/?format=json","name":"Delegation for relations with Australia and New Zealand","abbreviation":"","kind":"delegation"},{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"}]
\ No newline at end of file
[{"id":9,"url":"http://testserver/api/mandates/9/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/8/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":10,"url":"http://testserver/api/mandates/10/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/9/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2014-07-08","end_date":"9999-12-31"},{"id":12,"url":"http://testserver/api/mandates/12/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/10/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2014-07-14","end_date":"9999-12-31"},{"id":13,"url":"http://testserver/api/mandates/13/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/11/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2015-05-18","end_date":"9999-12-31"},{"id":15,"url":"http://testserver/api/mandates/15/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/13/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":17,"url":"http://testserver/api/mandates/17/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/14/?format=json","constituency":"http://testserver/api/constituencies/3/?format=json","role":"","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":2,"url":"http://testserver/api/mandates/2/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/2/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2013-10-09","end_date":"2014-06-30"},{"id":16,"url":"http://testserver/api/mandates/16/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/13/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":18,"url":"http://testserver/api/mandates/18/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/14/?format=json","constituency":"http://testserver/api/constituencies/3/?format=json","role":"","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":14,"url":"http://testserver/api/mandates/14/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/12/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2009-09-17","end_date":"2013-01-10"},{"id":11,"url":"http://testserver/api/mandates/11/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/8/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2009-07-16","end_date":"2012-01-18"},{"id":8,"url":"http://testserver/api/mandates/8/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/7/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2006-03-21","end_date":"2009-07-13"},{"id":4,"url":"http://testserver/api/mandates/4/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/4/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":6,"url":"http://testserver/api/mandates/6/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/6/?format=json","constituency":"http://testserver/api/constituencies/2/?format=json","role":"","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":1,"url":"http://testserver/api/mandates/1/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/1/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"1997-01-16","end_date":"1999-07-19"},{"id":5,"url":"http://testserver/api/mandates/5/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/5/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":7,"url":"http://testserver/api/mandates/7/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/6/?format=json","constituency":"http://testserver/api/constituencies/2/?format=json","role":"","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":3,"url":"http://testserver/api/mandates/3/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/3/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"1996-11-14","end_date":"1997-01-15"}]
\ No newline at end of file
[{"id":1,"url":"http://testserver/api/mandates/1/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/1/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"1997-01-16","end_date":"1999-07-19"},{"id":2,"url":"http://testserver/api/mandates/2/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/2/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2013-10-09","end_date":"2014-06-30"},{"id":3,"url":"http://testserver/api/mandates/3/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/3/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"1996-11-14","end_date":"1997-01-15"},{"id":4,"url":"http://testserver/api/mandates/4/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/4/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":5,"url":"http://testserver/api/mandates/5/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/5/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":6,"url":"http://testserver/api/mandates/6/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/6/?format=json","constituency":"http://testserver/api/constituencies/2/?format=json","role":"","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":7,"url":"http://testserver/api/mandates/7/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/6/?format=json","constituency":"http://testserver/api/constituencies/2/?format=json","role":"","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":8,"url":"http://testserver/api/mandates/8/?format=json","representative":"http://testserver/api/representatives/1/?format=json","group":"http://testserver/api/groups/7/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2006-03-21","end_date":"2009-07-13"},{"id":9,"url":"http://testserver/api/mandates/9/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/8/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":10,"url":"http://testserver/api/mandates/10/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/9/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2014-07-08","end_date":"9999-12-31"},{"id":11,"url":"http://testserver/api/mandates/11/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/8/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2009-07-16","end_date":"2012-01-18"},{"id":12,"url":"http://testserver/api/mandates/12/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/10/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2014-07-14","end_date":"9999-12-31"},{"id":13,"url":"http://testserver/api/mandates/13/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/11/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2015-05-18","end_date":"9999-12-31"},{"id":14,"url":"http://testserver/api/mandates/14/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/12/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Substitute","begin_date":"2009-09-17","end_date":"2013-01-10"},{"id":15,"url":"http://testserver/api/mandates/15/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/13/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":16,"url":"http://testserver/api/mandates/16/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/13/?format=json","constituency":"http://testserver/api/constituencies/1/?format=json","role":"Member","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":17,"url":"http://testserver/api/mandates/17/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/14/?format=json","constituency":"http://testserver/api/constituencies/3/?format=json","role":"","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":18,"url":"http://testserver/api/mandates/18/?format=json","representative":"http://testserver/api/representatives/2/?format=json","group":"http://testserver/api/groups/14/?format=json","constituency":"http://testserver/api/constituencies/3/?format=json","role":"","begin_date":"2009-07-14","end_date":"2014-06-30"}]
\ No newline at end of file
[{"id":2,"url":"http://testserver/api/representatives/2/?format=json","slug":"olle-ludvigsson-1948-10-28","first_name":"Olle","last_name":"LUDVIGSSON","full_name":"Olle LUDVIGSSON","gender":2,"birth_place":"Hälsö","birth_date":"1948-10-28","photo":"http://www.europarl.europa.eu/mepphoto/96673.jpg","active":true,"cv":"","contacts":{"emails":[{"email":"olle.ludvigsson@europarl.europa.eu","kind":"official"}],"phones":[{"number":"+322 28 45442","kind":"office phone"},{"number":"+333 88 1 75442","kind":"office phone"}],"websites":[{"url":"http://www.sap.se/olle","kind":""},{"url":"http://twitter.com/olleludvigsson","kind":"twitter"},{"url":"https://www.facebook.com/olle.ludvigsson","kind":"facebook"},{"url":"http://www.europarl.europa.eu/meps/en/96673/_home.html","kind":"EP"}],"address":[{"country":{"id":1050,"url":"http://testserver/api/countries/1050/?format=json","name":"Belgium","code":"BE"},"city":"Brussels","street":"rue Wiertz / Wiertzstraat","number":"60","postcode":"1047","floor":"14G","office_number":"257","kind":"official"},{"country":{"id":1095,"url":"http://testserver/api/countries/1095/?format=json","name":"France","code":"FR"},"city":"Strasbourg","street":"Av. du Président Robert Schuman - CS 91024","number":"1","postcode":"67070","floor":"T07","office_number":"070","kind":"official"}]},"mandates":[{"id":9,"url":"http://testserver/api/mandates/9/?format=json","group":{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":10,"url":"http://testserver/api/mandates/10/?format=json","group":{"id":9,"url":"http://testserver/api/groups/9/?format=json","name":"Committee on Industry, Research and Energy","abbreviation":"ITRE","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2014-07-08","end_date":"9999-12-31"},{"id":12,"url":"http://testserver/api/mandates/12/?format=json","group":{"id":10,"url":"http://testserver/api/groups/10/?format=json","name":"Delegation to the EU-Serbia Stabilisation and Association Parliamentary Committee","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-14","end_date":"9999-12-31"},{"id":13,"url":"http://testserver/api/mandates/13/?format=json","group":{"id":11,"url":"http://testserver/api/groups/11/?format=json","name":"Delegation for relations with Bosnia and Herzegovina, and Kosovo","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2015-05-18","end_date":"9999-12-31"},{"id":15,"url":"http://testserver/api/mandates/15/?format=json","group":{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":17,"url":"http://testserver/api/mandates/17/?format=json","group":{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"},"constituency":{"id":3,"url":"http://testserver/api/constituencies/3/?format=json","name":"Arbetarepartiet- Socialdemokraterna"},"role":"","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":16,"url":"http://testserver/api/mandates/16/?format=json","group":{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":18,"url":"http://testserver/api/mandates/18/?format=json","group":{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"},"constituency":{"id":3,"url":"http://testserver/api/constituencies/3/?format=json","name":"Arbetarepartiet- Socialdemokraterna"},"role":"","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":14,"url":"http://testserver/api/mandates/14/?format=json","group":{"id":12,"url":"http://testserver/api/groups/12/?format=json","name":"Delegation for relations with Australia and New Zealand","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2009-09-17","end_date":"2013-01-10"},{"id":11,"url":"http://testserver/api/mandates/11/?format=json","group":{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2009-07-16","end_date":"2012-01-18"}]},{"id":1,"url":"http://testserver/api/representatives/1/?format=json","slug":"hubert-pirker-1948-10-03","first_name":"Hubert","last_name":"PIRKER","full_name":"Hubert PIRKER","gender":2,"birth_place":"Gries","birth_date":"1948-10-03","photo":"http://www.europarl.europa.eu/mepphoto/2307.jpg","active":false,"cv":"Transport and security spokesman, ÖVP Delegation, European Parliament;\nsecurity spokesman, ÖVP Delegation, European Parliament (2006-2009); security spokesman (coordinator), EPP Group (1999-2004); Deputy Head of ÖVP Delegation, European Parliament (1996-2004);","contacts":{"emails":[],"phones":[],"websites":[{"url":"http://www.europarl.europa.eu/meps/en/2307/_home.html","kind":"EP"}],"address":[]},"mandates":[{"id":2,"url":"http://testserver/api/mandates/2/?format=json","group":{"id":2,"url":"http://testserver/api/groups/2/?format=json","name":"Delegation for relations with the countries of Southeast Asia and the Association of Southeast Asian Nations (ASEAN)","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2013-10-09","end_date":"2014-06-30"},{"id":8,"url":"http://testserver/api/mandates/8/?format=json","group":{"id":7,"url":"http://testserver/api/groups/7/?format=json","name":"Conference of Delegation Chairs","abbreviation":"","kind":"organization"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2006-03-21","end_date":"2009-07-13"},{"id":4,"url":"http://testserver/api/mandates/4/?format=json","group":{"id":4,"url":"http://testserver/api/groups/4/?format=json","name":"Group of the European People's Party (Christian Democrats) and European Democrats","abbreviation":"PPE-DE","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":6,"url":"http://testserver/api/mandates/6/?format=json","group":{"id":6,"url":"http://testserver/api/groups/6/?format=json","name":"Austria","abbreviation":"AT","kind":"country"},"constituency":{"id":2,"url":"http://testserver/api/constituencies/2/?format=json","name":"Österreichische Volkspartei"},"role":"","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":1,"url":"http://testserver/api/mandates/1/?format=json","group":{"id":1,"url":"http://testserver/api/groups/1/?format=json","name":"Committee on Employment and Social Affairs","abbreviation":"EMPL","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"1997-01-16","end_date":"1999-07-19"},{"id":5,"url":"http://testserver/api/mandates/5/?format=json","group":{"id":5,"url":"http://testserver/api/groups/5/?format=json","name":"Group of the European People's Party (Christian-Democratic Group)","abbreviation":"EPP","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":7,"url":"http://testserver/api/mandates/7/?format=json","group":{"id":6,"url":"http://testserver/api/groups/6/?format=json","name":"Austria","abbreviation":"AT","kind":"country"},"constituency":{"id":2,"url":"http://testserver/api/constituencies/2/?format=json","name":"Österreichische Volkspartei"},"role":"","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":3,"url":"http://testserver/api/mandates/3/?format=json","group":{"id":3,"url":"http://testserver/api/groups/3/?format=json","name":"Delegation for relations with the Member States of ASEAN, South-east Asia and the Republic of Korea","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"1996-11-14","end_date":"1997-01-15"}]}]
\ No newline at end of file
[{"id":1,"url":"http://testserver/api/representatives/1/?format=json","slug":"hubert-pirker-1948-10-03","first_name":"Hubert","last_name":"PIRKER","full_name":"Hubert PIRKER","gender":2,"birth_place":"Gries","birth_date":"1948-10-03","photo":"http://www.europarl.europa.eu/mepphoto/2307.jpg","active":false,"cv":"Transport and security spokesman, ÖVP Delegation, European Parliament;\nsecurity spokesman, ÖVP Delegation, European Parliament (2006-2009); security spokesman (coordinator), EPP Group (1999-2004); Deputy Head of ÖVP Delegation, European Parliament (1996-2004);","contacts":{"emails":[],"phones":[],"websites":[{"url":"http://www.europarl.europa.eu/meps/en/2307/_home.html","kind":"EP"}],"address":[]},"mandates":[{"id":2,"url":"http://testserver/api/mandates/2/?format=json","group":{"id":2,"url":"http://testserver/api/groups/2/?format=json","name":"Delegation for relations with the countries of Southeast Asia and the Association of Southeast Asian Nations (ASEAN)","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2013-10-09","end_date":"2014-06-30"},{"id":8,"url":"http://testserver/api/mandates/8/?format=json","group":{"id":7,"url":"http://testserver/api/groups/7/?format=json","name":"Conference of Delegation Chairs","abbreviation":"","kind":"organization"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2006-03-21","end_date":"2009-07-13"},{"id":6,"url":"http://testserver/api/mandates/6/?format=json","group":{"id":6,"url":"http://testserver/api/groups/6/?format=json","name":"Austria","abbreviation":"AT","kind":"country"},"constituency":{"id":2,"url":"http://testserver/api/constituencies/2/?format=json","name":"Österreichische Volkspartei"},"role":"","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":4,"url":"http://testserver/api/mandates/4/?format=json","group":{"id":4,"url":"http://testserver/api/groups/4/?format=json","name":"Group of the European People's Party (Christian Democrats) and European Democrats","abbreviation":"PPE-DE","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"1999-07-20","end_date":"2004-07-19"},{"id":5,"url":"http://testserver/api/mandates/5/?format=json","group":{"id":5,"url":"http://testserver/api/groups/5/?format=json","name":"Group of the European People's Party (Christian-Democratic Group)","abbreviation":"EPP","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":1,"url":"http://testserver/api/mandates/1/?format=json","group":{"id":1,"url":"http://testserver/api/groups/1/?format=json","name":"Committee on Employment and Social Affairs","abbreviation":"EMPL","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"1997-01-16","end_date":"1999-07-19"},{"id":7,"url":"http://testserver/api/mandates/7/?format=json","group":{"id":6,"url":"http://testserver/api/groups/6/?format=json","name":"Austria","abbreviation":"AT","kind":"country"},"constituency":{"id":2,"url":"http://testserver/api/constituencies/2/?format=json","name":"Österreichische Volkspartei"},"role":"","begin_date":"1996-11-11","end_date":"1999-07-19"},{"id":3,"url":"http://testserver/api/mandates/3/?format=json","group":{"id":3,"url":"http://testserver/api/groups/3/?format=json","name":"Delegation for relations with the Member States of ASEAN, South-east Asia and the Republic of Korea","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"1996-11-14","end_date":"1997-01-15"}]},{"id":2,"url":"http://testserver/api/representatives/2/?format=json","slug":"olle-ludvigsson-1948-10-28","first_name":"Olle","last_name":"LUDVIGSSON","full_name":"Olle LUDVIGSSON","gender":2,"birth_place":"Hälsö","birth_date":"1948-10-28","photo":"http://www.europarl.europa.eu/mepphoto/96673.jpg","active":true,"cv":"","contacts":{"emails":[{"email":"olle.ludvigsson@europarl.europa.eu","kind":"official"}],"phones":[{"number":"+322 28 45442","kind":"office phone"},{"number":"+333 88 1 75442","kind":"office phone"}],"websites":[{"url":"http://www.sap.se/olle","kind":""},{"url":"http://twitter.com/olleludvigsson","kind":"twitter"},{"url":"https://www.facebook.com/olle.ludvigsson","kind":"facebook"},{"url":"http://www.europarl.europa.eu/meps/en/96673/_home.html","kind":"EP"}],"address":[{"country":{"id":1050,"url":"http://testserver/api/countries/1050/?format=json","name":"Belgium","code":"BE"},"city":"Brussels","street":"rue Wiertz / Wiertzstraat","number":"60","postcode":"1047","floor":"14G","office_number":"257","kind":"official"},{"country":{"id":1095,"url":"http://testserver/api/countries/1095/?format=json","name":"France","code":"FR"},"city":"Strasbourg","street":"Av. du Président Robert Schuman - CS 91024","number":"1","postcode":"67070","floor":"T07","office_number":"070","kind":"official"}]},"mandates":[{"id":10,"url":"http://testserver/api/mandates/10/?format=json","group":{"id":9,"url":"http://testserver/api/groups/9/?format=json","name":"Committee on Industry, Research and Energy","abbreviation":"ITRE","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2014-07-08","end_date":"9999-12-31"},{"id":9,"url":"http://testserver/api/mandates/9/?format=json","group":{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":17,"url":"http://testserver/api/mandates/17/?format=json","group":{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"},"constituency":{"id":3,"url":"http://testserver/api/constituencies/3/?format=json","name":"Arbetarepartiet- Socialdemokraterna"},"role":"","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":15,"url":"http://testserver/api/mandates/15/?format=json","group":{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-01","end_date":"9999-12-31"},{"id":13,"url":"http://testserver/api/mandates/13/?format=json","group":{"id":11,"url":"http://testserver/api/groups/11/?format=json","name":"Delegation for relations with Bosnia and Herzegovina, and Kosovo","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2015-05-18","end_date":"9999-12-31"},{"id":12,"url":"http://testserver/api/mandates/12/?format=json","group":{"id":10,"url":"http://testserver/api/groups/10/?format=json","name":"Delegation to the EU-Serbia Stabilisation and Association Parliamentary Committee","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2014-07-14","end_date":"9999-12-31"},{"id":18,"url":"http://testserver/api/mandates/18/?format=json","group":{"id":14,"url":"http://testserver/api/groups/14/?format=json","name":"Sweden","abbreviation":"SE","kind":"country"},"constituency":{"id":3,"url":"http://testserver/api/constituencies/3/?format=json","name":"Arbetarepartiet- Socialdemokraterna"},"role":"","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":16,"url":"http://testserver/api/mandates/16/?format=json","group":{"id":13,"url":"http://testserver/api/groups/13/?format=json","name":"Group of the Progressive Alliance of Socialists and Democrats in the European Parliament","abbreviation":"SD","kind":"group"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Member","begin_date":"2009-07-14","end_date":"2014-06-30"},{"id":14,"url":"http://testserver/api/mandates/14/?format=json","group":{"id":12,"url":"http://testserver/api/groups/12/?format=json","name":"Delegation for relations with Australia and New Zealand","abbreviation":"","kind":"delegation"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2009-09-17","end_date":"2013-01-10"},{"id":11,"url":"http://testserver/api/mandates/11/?format=json","group":{"id":8,"url":"http://testserver/api/groups/8/?format=json","name":"Committee on Economic and Monetary Affairs","abbreviation":"ECON","kind":"committee"},"constituency":{"id":1,"url":"http://testserver/api/constituencies/1/?format=json","name":"European Parliament"},"role":"Substitute","begin_date":"2009-07-16","end_date":"2012-01-18"}]}]
\ No newline at end of file
......@@ -16,7 +16,8 @@ class RecommendationViewSet(viewsets.ReadOnlyModelViewSet):
"""
API endpoint that allows recommendations to be viewed.
"""
queryset = Recommendation.objects.select_related('proposal')
queryset = Recommendation.objects.select_related('proposal') \
.order_by('proposal_id', 'id')
filter_backends = (
filters.DjangoFilterBackend,
filters.SearchFilter,
......
......@@ -26,7 +26,7 @@ class DossierViewSet(viewsets.ReadOnlyModelViewSet):
"""
pagination_class = DefaultWebPagination
queryset = Dossier.objects.all()
queryset = Dossier.objects.order_by('id')
serializer_class = DossierSerializer
filter_backends = (
......@@ -47,8 +47,6 @@ class DossierViewSet(viewsets.ReadOnlyModelViewSet):
'proposals__title'
)
ordering_fields = ['reference']
def retrieve(self, request, pk=None):
self.serializer_class = DossierDetailSerializer
self.queryset = self.queryset.prefetch_related('proposals',
......@@ -62,7 +60,7 @@ class ProposalViewSet(viewsets.ReadOnlyModelViewSet):
"""
pagination_class = DefaultWebPagination
queryset = Proposal.objects.all()
queryset = Proposal.objects.order_by('id')
serializer_class = ProposalSerializer
filter_backends = (
......@@ -86,8 +84,6 @@ class ProposalViewSet(viewsets.ReadOnlyModelViewSet):
'dossier__reference'
)
ordering_fields = ['reference']
def retrieve(self, request, pk=None):
self.serializer_class = ProposalDetailSerializer
return super(ProposalViewSet, self).retrieve(request, pk)
......@@ -99,7 +95,8 @@ class VoteViewSet(viewsets.ReadOnlyModelViewSet):
"""
pagination_class = DefaultWebPagination
queryset = Vote.objects.select_related('representative', 'proposal')
queryset = Vote.objects.select_related('representative', 'proposal') \
.order_by('proposal_id', 'representative__slug')
serializer_class = VoteSerializer
filter_backends = (
......
......@@ -13,12 +13,12 @@
"votes": [
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/2/",
"representative": "http://testserver/api/representatives/1/",
"position": "abstain"
},
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/1/",
"representative": "http://testserver/api/representatives/2/",
"position": "abstain"
}
]
......
[
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/2/",
"representative": "http://testserver/api/representatives/1/",
"position": "abstain"
},
{
"proposal": "http://testserver/api/proposals/1/",
"representative": "http://testserver/api/representatives/1/",
"representative": "http://testserver/api/representatives/2/",
"position": "abstain"
},
{
"proposal": "http://testserver/api/proposals/2/",
"representative": "http://testserver/api/representatives/2/",
"representative": "http://testserver/api/representatives/1/",
"position": "for"
},
{
"proposal": "http://testserver/api/proposals/2/",
"representative": "http://testserver/api/representatives/1/",
"representative": "http://testserver/api/representatives/2/",
"position": "for"
},
{
"proposal": "http://testserver/api/proposals/3/",
"representative": "http://testserver/api/representatives/2/",
"representative": "http://testserver/api/representatives/1/",
"position": "against"
},
{
"proposal": "http://testserver/api/proposals/3/",
"representative": "http://testserver/api/representatives/1/",
"representative": "http://testserver/api/representatives/2/",
"position": "against"
},
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment