Commit add0b2a6 authored by njoyard's avatar njoyard Committed by GitHub

Merge pull request #28 from political-memory/remove-fingerprints

Remove fingerprints
parents 67bad5f3 6497db9d
......@@ -36,14 +36,12 @@ class DossierViewSet(viewsets.ReadOnlyModelViewSet):
)
filter_fields = {
'fingerprint': ['exact'],
'title': ['exact', 'icontains'],
'reference': ['exact', 'icontains'],
}
search_fields = (
'title',
'fingerprint',
'reference',
'text',
'proposals__title'
......@@ -73,8 +71,6 @@ class ProposalViewSet(viewsets.ReadOnlyModelViewSet):
)
filter_fields = {
'fingerprint': ['exact'],
'dossier__fingerprint': ['exact'],
'title': ['exact', 'icontains'],
'description': ['icontains'],
'reference': ['exact', 'icontains'],
......@@ -84,8 +80,7 @@ class ProposalViewSet(viewsets.ReadOnlyModelViewSet):
search_fields = (
'title',
'fingerprint', 'reference',
'dossier__fingerprint',
'reference',
'dossier__title',
'dossier__reference'
)
......@@ -113,7 +108,6 @@ class VoteViewSet(viewsets.ReadOnlyModelViewSet):
)
filter_fields = {
'proposal__fingerprint': ['exact'],
'position': ['exact'],
'representative_name': ['exact', 'icontains'],
'representative': ['exact']
......
......@@ -7,8 +7,7 @@
"text": "",
"created": "2016-02-14T13:16:31.417Z",
"link": "http://www.assemblee-nationale.fr/14/dossiers/liberte_maires_rythmes_scolaires_premier_degre.asp",
"ext_link": "",
"fingerprint": "5d1707e6663bb28d0308cdb36e9e91c5f235f8a1"
"ext_link": ""
},
"model": "representatives_votes.dossier",
"pk": 1
......@@ -21,8 +20,7 @@
"text": "",
"created": "2016-02-14T13:16:31.428Z",
"link": "http://www.assemblee-nationale.fr/14/dossiers/action_publique_territoriale_metropoles.asp",
"ext_link": "http://www.senat.fr/dossier-legislatif/pjl12-495.html",
"fingerprint": "c03f5e32f66e5f03ebe0a5d100f2f4ade941accc"
"ext_link": "http://www.senat.fr/dossier-legislatif/pjl12-495.html"
},
"model": "representatives_votes.dossier",
"pk": 2
......@@ -35,8 +33,7 @@
"text": "",
"created": "2016-02-21T14:34:35.721Z",
"link": "http://www.senat.fr/dossier-legislatif/ppl13-799.html",
"ext_link": "",
"fingerprint": "5c58ebd00b9614e0965f173c8acb2bb77eb28f00"
"ext_link": ""
},
"model": "representatives_votes.dossier",
"pk": 3
......
......@@ -12,7 +12,6 @@
"active": true,
"birth_place": "Lille (Nord)",
"full_name": "Bernard Roman",
"fingerprint": "e28b45cced3c89ad3835fbdf261367ebea91b180",
"birth_date": "1952-07-15",
"slug": "bernard-roman"
},
......
......@@ -11,7 +11,6 @@
"kind": "dossier",
"datetime": "2013-12-04T23:00:00Z",
"total_against": 0,
"fingerprint": "40bb927c36b00bb688c1d7e7f4be5b9a1aae4af3",
"total_abstain": 0
},
"model": "representatives_votes.proposal",
......@@ -29,7 +28,6 @@
"kind": "dossier",
"datetime": "2013-12-05T23:00:00Z",
"total_against": 0,
"fingerprint": "a8709fb12e8e6e4a5f46931d855bf70453dd7fd2",
"total_abstain": 0
},
"model": "representatives_votes.proposal",
......@@ -47,7 +45,6 @@
"kind": "dossier",
"datetime": "2013-12-10T23:00:00Z",
"total_against": 0,
"fingerprint": "abf1dbdff878fa750f6ffb33fb362cb734e553e3",
"total_abstain": 0
},
"model": "representatives_votes.proposal",
......@@ -65,7 +62,6 @@
"kind": "dossier",
"datetime": "2013-12-10T23:00:00Z",
"total_against": 0,
"fingerprint": "3b75e49e1be0c8efc3706b9896cc1cb1f76dd9a7",
"total_abstain": 0
},
"model": "representatives_votes.proposal",
......
......@@ -11,7 +11,6 @@
"kind": "dossier",
"datetime": "2013-12-04T23:00:00Z",
"total_against": 0,
"fingerprint": "40bb927c36b00bb688c1d7e7f4be5b9a1aae4af3",
"total_abstain": 0
},
"model": "representatives_votes.proposal",
......@@ -29,7 +28,6 @@
"kind": "dossier",
"datetime": "2013-12-05T23:00:00Z",
"total_against": 1,
"fingerprint": "a8709fb12e8e6e4a5f46931d855bf70453dd7fd2",
"total_abstain": 0
},
"model": "representatives_votes.proposal",
......@@ -47,7 +45,6 @@
"kind": "dossier",
"datetime": "2013-12-10T23:00:00Z",
"total_against": 0,
"fingerprint": "abf1dbdff878fa750f6ffb33fb362cb734e553e3",
"total_abstain": 1
},
"model": "representatives_votes.proposal",
......@@ -65,7 +62,6 @@
"kind": "dossier",
"datetime": "2013-12-10T23:00:00Z",
"total_against": 0,
"fingerprint": "3b75e49e1be0c8efc3706b9896cc1cb1f76dd9a7",
"total_abstain": 0
},
"model": "representatives_votes.proposal",
......
......@@ -6,8 +6,7 @@
"title": "Agenda for change: the future of EU development policy",
"text": "",
"created": "2015-12-13T10:11:31.369Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)",
"fingerprint": "9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)"
},
"model": "representatives_votes.dossier",
"pk": 1
......@@ -19,8 +18,7 @@
"title": "2016 general budget: all sections",
"text": "",
"created": "2015-12-13T10:11:31.378Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2132(BUD)",
"fingerprint": "e6856e0880e701c1022f23d595cc37a9a1cdcca8"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2132(BUD)"
},
"model": "representatives_votes.dossier",
"pk": 2
......@@ -32,8 +30,7 @@
"title": "Scheme of control and enforcement applicable in the area covered by the Convention on future multilateral cooperation in the North-East Atlantic fisheries",
"text": "",
"created": "2015-12-13T10:11:31.388Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2013/2857(DEA)",
"fingerprint": "50745a1a6e47b8db097c55ef21a4f11fc1ef0d97"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2013/2857(DEA)"
},
"model": "representatives_votes.dossier",
"pk": 3
......@@ -45,8 +42,7 @@
"title": "Scheme of control and enforcement applicable in the area covered by the Convention on future multilateral cooperation in the North-East Atlantic fisheries",
"text": "",
"created": "2015-12-13T10:11:31.398Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2623(DEA)",
"fingerprint": "65fce7af2e020ff58849d1663f2c30ab0b1a35db"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2623(DEA)"
},
"model": "representatives_votes.dossier",
"pk": 4
......@@ -58,8 +54,7 @@
"title": "Scheme of control and enforcement applicable in the area covered by the Convention on future multilateral cooperation in the North-East Atlantic fisheries",
"text": "",
"created": "2015-12-13T10:11:31.408Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2009/0051(COD)",
"fingerprint": "f2abba201c10df8a7cec1d734f91b7988eec8260"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2009/0051(COD)"
},
"model": "representatives_votes.dossier",
"pk": 5
......
......@@ -6,8 +6,7 @@
"title": "2016 general budget: all sections",
"text": "",
"created": "2015-12-13T10:11:31.378Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2132(BUD)",
"fingerprint": "e6856e0880e701c1022f23d595cc37a9a1cdcca8"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2132(BUD)"
},
"model": "representatives_votes.dossier",
"pk": 1
......
......@@ -6,8 +6,7 @@
"title": "Agenda for change: the future of EU development policy",
"text": "",
"created": "2015-12-13T10:11:31.369Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)",
"fingerprint": "9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)"
},
"model": "representatives_votes.dossier",
"pk": 1
......
......@@ -6,8 +6,7 @@
"title": "initial title",
"text": "",
"created": "2015-12-13T10:11:31.369Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)",
"fingerprint": "9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)"
},
"model": "representatives_votes.dossier",
"pk": 1
......
......@@ -64,7 +64,7 @@ class DossierTest(TestCase):
representatives.__path__[0]), 'fixtures',
'representatives_test.json'))
with self.assertNumQueries(16):
with self.assertNumQueries(15):
_test_import('single', import_dossiers.import_single)
def test_parltrack_sync_dossier(self):
......
......@@ -6,8 +6,7 @@
"title": "Agenda for change: the future of EU development policy",
"text": "",
"created": "2015-12-13T01:10:09.683Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)",
"fingerprint": "9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2012/2002(INI)"
},
"model": "representatives_votes.dossier",
"pk": 64
......@@ -19,8 +18,7 @@
"title": "2016 general budget: all sections",
"text": "",
"created": "2015-12-13T01:10:09.698Z",
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2132(BUD)",
"fingerprint": "e6856e0880e701c1022f23d595cc37a9a1cdcca8"
"link": "http://www.europarl.europa.eu/oeil/popups/ficheprocedure.do?reference=2015/2132(BUD)"
},
"model": "representatives_votes.dossier",
"pk": 65
......@@ -38,7 +36,6 @@
"active": false,
"birth_place": "Gries",
"full_name": "Hubert PIRKER",
"fingerprint": "2a3c90346d40e9c540050534d832ceb3e0d25a49",
"birth_date": "1948-10-03",
"slug": "hubert-pirker"
},
......@@ -58,7 +55,6 @@
"active": true,
"birth_place": "H\u00e4ls\u00f6",
"full_name": "Olle LUDVIGSSON",
"fingerprint": "314d0f4c25af31bfa2a6b286838367994b902615",
"birth_date": "1948-10-28",
"slug": "olle-ludvigsson"
},
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('representatives_votes', '0010_proposal_datetime_index'),
]
operations = [
migrations.AlterUniqueTogether(
name='dossier',
unique_together=set([('title', 'reference')]),
),
migrations.AlterUniqueTogether(
name='proposal',
unique_together=set([('dossier', 'title', 'reference', 'kind', 'total_abstain', 'total_against', 'total_for')]),
),
migrations.RemoveField(
model_name='dossier',
name='fingerprint',
),
migrations.RemoveField(
model_name='proposal',
name='fingerprint',
),
]
# coding: utf-8
from django.db import models
from representatives.models import (HashableModel, Representative,
TimeStampedModel)
from representatives.models import Representative, TimeStampedModel
class Dossier(HashableModel, TimeStampedModel):
class Dossier(TimeStampedModel):
title = models.CharField(max_length=1000)
reference = models.CharField(max_length=200, unique=True)
text = models.TextField(blank=True, default='')
link = models.URLField()
ext_link = models.URLField(blank=True, default='')
hashable_fields = ['title', 'reference']
class Meta:
unique_together = (('title', 'reference'))
def __unicode__(self):
return unicode(self.title)
class Proposal(HashableModel, TimeStampedModel):
class Proposal(TimeStampedModel):
dossier = models.ForeignKey(Dossier, related_name='proposals')
title = models.CharField(max_length=1000, unique=True)
description = models.TextField(blank=True, default='')
......@@ -33,12 +33,11 @@ class Proposal(HashableModel, TimeStampedModel):
Representative, through='Vote', related_name='proposals'
)
hashable_fields = ['dossier', 'title', 'reference',
'kind', 'total_abstain', 'total_against',
'total_for']
class Meta:
ordering = ['datetime']
unique_together = (('dossier', 'title', 'reference',
'kind', 'total_abstain', 'total_against',
'total_for'))
@property
def status(self):
......
......@@ -28,7 +28,6 @@
],
"created": "2015-12-27T11:51:14.770000Z",
"updated": "2015-12-27T11:51:14.770000Z",
"fingerprint": "9e2cccdc5f6d22afd008af8b5b55dc193c27c5d6",
"title": "Agenda for change: the future of EU development policy",
"reference": "2012/2002(INI)",
"text": "",
......
......@@ -13,7 +13,7 @@ setup(
keywords='django government parliament votes',
install_requires=[
'django>1.8,<1.9',
'django-representatives>=0.0.23',
'django-representatives>=0.0.27',
'py-dateutil>=2,<3',
'ijson>=2,<3',
'pytz', # Always use up-to-date TZ data
......
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