Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5015362
Switch to the django-1.7 branch of popit-django
mhl Jul 13, 2016
17b0866
Add mysociety-django-popolo at version 0.0.7
mhl Jul 7, 2016
4ce0c9d
Add multiple-django-popolo-sources
mhl Sep 18, 2016
73af672
Add parallel fields / models for migrating data to django-popolo
mhl Jul 7, 2016
8231279
Migrate data from popit-django to django-popolo
mhl Jul 11, 2016
197bb37
After the data migration, remove the null option for new fields
mhl Jul 13, 2016
7a2c004
Remove old popit-django model references
mhl Jul 13, 2016
10f61f7
Rename the now-migrated fields to the more concise names
mhl Jul 13, 2016
4a5c89e
Remove a now unneeded popitapiinstance field
mhl Jul 14, 2016
774c87e
Add a note about how django-popit needs to be still installed :(
mhl Jul 14, 2016
dd65d95
Remove an import from django-popit in global_test_case.py
mhl Jul 14, 2016
8162c95
Update the example_data.yaml fixture for django-popolo models
mhl Jul 14, 2016
5f97957
Switch code from Membership to InstanceMembership
mhl Sep 5, 2016
e183066
Update the admin to use the new django-popolo models
mhl Sep 5, 2016
755e5a8
Fix naive datettime warnings on loaddata
mhl Jul 15, 2016
596690a
Switch Person imports from popit-django to django-popolo
mhl Sep 5, 2016
0c76a00
Remove imports of the popit-django ApiInstance
mhl Sep 5, 2016
cdd8579
Add a proxy model PopoloPerson with helpful properties
mhl Sep 5, 2016
df6d543
Update the webhook payload and corresponding tests
mhl Jul 15, 2016
b100409
Remove the old PopIt proxy models
mhl Sep 5, 2016
6055d68
Switch code from using ApiInstance to PopoloSource
mhl Sep 5, 2016
d1a592c
Change the test PopIt API URL to point to the export.json endpoint
mhl Sep 5, 2016
28f0be8
Make WriteitInstancePopitInstanceRecord.__unicode__ use PopoloSource URL
mhl Sep 5, 2016
a0c2707
Allow WriteItInstance.add_person to take the base Person model
mhl Sep 21, 2016
7966ffa
Update the code to sync from Popolo JSON, not a PopIt instance
mhl Sep 5, 2016
d634aa2
Update tests for whether a membership is current
mhl Sep 5, 2016
0adf5e3
Switch the EveryPolitician country selector to use Popolo JSON URLs
mhl Sep 22, 2016
49e6a75
Update a test to use a django-popolo Identifier to get a person's ID
mhl Sep 5, 2016
ec4e71d
Switch to using the PopoloPerson proxy model
mhl Aug 25, 2016
b979cb6
Re-record fixtures now that we're only using PopIt's export.json
mhl Sep 5, 2016
87f4fbe
Use old_popit_url instead of popit_url in the API code & tests
mhl Sep 5, 2016
835e0e7
Switch a test from using PopitApiInstance to PopoloSource
mhl Sep 5, 2016
f5f5c3c
Update the MessagePerPersonView to use popolo_source_id
mhl Sep 5, 2016
6033f39
Fixes for the API tests
mhl Aug 25, 2016
813cc54
Update fixtures for current PopIt's ID handling
mhl Sep 2, 2016
5bb1370
Make (probably-should-be-deprecated) methods use the popit_id Identifier
mhl Sep 2, 2016
d40922b
Change the resync URL's kwarg to use popolo_source_pk, not popit_api_pk
mhl Sep 2, 2016
f927637
Update start_local_popit_api.bash use current PopIt
mhl Sep 2, 2016
3a2972d
Which of two identical email addresses is used doesn't matter
mhl Sep 2, 2016
67b1869
Remove Contact.popit_identifier, which isn't used for anything
mhl Sep 2, 2016
5083572
Update references to source URLs in the templates
mhl Sep 5, 2016
f3dcc3e
Use uri_for_api instead of popit_url in the API documentation
mhl Sep 5, 2016
b0a63e0
Fix tests broken by switching to popolo_sources.PopoloSource
mhl Sep 21, 2016
66160ec
Make a test docstring a bit more clear
mhl Sep 22, 2016
1c63a15
Fix an intermittent test failure due to unpredictable ordering
mhl Oct 27, 2016
d579dab
fixup! Fixes for the API tests
mhl Oct 27, 2016
a91533c
If we can tell which people are current, only include them
mhl Dec 5, 2016
a08e7d5
Add a command to fix bad popolo_uri Identifier objects
mhl Jan 6, 2017
6f2713f
Update the version of mysociety-django-popolo used to be 0.0.8
mhl Jan 9, 2017
51f010b
Preserve legacy identifiers when syncing from a data source
mhl Jan 9, 2017
3c70828
Don't duplicate popolo_uri identifiers on resyncing data
mhl Jan 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions contactos/migrations/0002_contact_popolo_person.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('popolo', '0002_update_models_from_upstream'),
('contactos', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='contact',
name='popolo_person',
field=models.ForeignKey(blank=True, to='popolo.Person', null=True),
preserve_default=True,
),
]
21 changes: 21 additions & 0 deletions contactos/migrations/0003_denull_popolo_people.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('contactos', '0002_contact_popolo_person'),
('instance', '0004_add_django_popolo_people'),
]

operations = [
migrations.AlterField(
model_name='contact',
name='popolo_person',
field=models.ForeignKey(to='popolo.Person'),
preserve_default=True,
),
]
18 changes: 18 additions & 0 deletions contactos/migrations/0004_remove_contact_person.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('contactos', '0003_denull_popolo_people'),
]

operations = [
migrations.RemoveField(
model_name='contact',
name='person',
),
]
19 changes: 19 additions & 0 deletions contactos/migrations/0005_rename_migrated_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('contactos', '0004_remove_contact_person'),
]

operations = [
migrations.RenameField(
model_name='contact',
old_name='popolo_person',
new_name='person',
),
]
18 changes: 18 additions & 0 deletions contactos/migrations/0006_remove_contact_popit_identifier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('contactos', '0005_rename_migrated_fields'),
]

operations = [
migrations.RemoveField(
model_name='contact',
name='popit_identifier',
),
]
3 changes: 1 addition & 2 deletions contactos/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from popit.models import Person
from popolo.models import Person as Person
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.db.models.signals import pre_save
Expand All @@ -26,7 +26,6 @@ class Contact(models.Model):
is_bounced = models.BooleanField(default=False)
owner = models.ForeignKey(User, related_name="contacts", null=True)
writeitinstance = models.ForeignKey('instance.WriteItInstance', related_name="contacts", null=True)
popit_identifier = models.CharField(max_length=512, null=True)
enabled = models.BooleanField(default=True)

def __unicode__(self):
Expand Down
25 changes: 1 addition & 24 deletions contactos/tests/contacts_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from global_test_case import GlobalTestCase as TestCase
from nuntium.user_section.tests.user_section_views_tests import UserSectionTestCase
from contactos.models import ContactType, Contact
from popit.models import Person
from popolo.models import Person
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.core import mail
Expand Down Expand Up @@ -74,14 +74,12 @@ def test_create_contact(self):
value='contact point',
person=self.person,
writeitinstance=writeitinstance,
popit_identifier='12345'
)
self.assertTrue(contact1)
self.assertFalse(contact1.is_bounced)
self.assertEquals(contact1.contact_type, contact_type)
self.assertEquals(contact1.value, 'contact point')
self.assertEquals(contact1.person, self.person)
self.assertEquals(contact1.popit_identifier, '12345')
self.assertTrue(contact1.enabled)

def test_contact_with_writeitinstance(self):
Expand All @@ -96,34 +94,13 @@ def test_contact_with_writeitinstance(self):
value='contact point',
person=self.person,
writeitinstance=writeitinstance,
popit_identifier='12345'
)
self.assertTrue(contact1)
self.assertFalse(contact1.is_bounced)
self.assertEquals(contact1.contact_type, contact_type)
self.assertEquals(contact1.value, 'contact point')
self.assertEquals(contact1.person, self.person)
self.assertEquals(contact1.writeitinstance, writeitinstance)
self.assertEquals(contact1.popit_identifier, '12345')

def test_create_contact_without_popit_identifier(self):
'''Create a contact without any reference to popit'''
contact_type = ContactType.objects.create(
name='mental message',
label_name='mental address id',
)
writeitinstance = WriteItInstance.objects.get(id=1)
contact1 = Contact.objects.create(
contact_type=contact_type,
value='contact point',
person=self.person,
writeitinstance=writeitinstance,
)
self.assertTrue(contact1)
self.assertFalse(contact1.is_bounced)
self.assertEquals(contact1.contact_type, contact_type)
self.assertEquals(contact1.value, 'contact point')
self.assertEquals(contact1.person, self.person)

def test_contacts_reverse_name(self):
# Yeah I did another test just to say that I have one more
Expand Down
2 changes: 1 addition & 1 deletion contactos/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.utils.decorators import method_decorator
from subdomains.utils import reverse
from instance.models import WriteItInstance
from popit.models import Person
from popolo.models import Person
from django.http import Http404


Expand Down
127 changes: 108 additions & 19 deletions example_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
model: sites.site
pk: 1
- fields:
date_joined: 2013-04-26 21:09:22.224616+00:00
date_joined: '2013-04-26T21:09:22Z'
email: admin@admines.cl
first_name: 'Administrador del system'
groups: []
is_active: true
is_staff: true
is_superuser: true
last_login: 2013-06-10 16:06:46.989439+00:00
last_login: '2013-06-10T16:06:46Z'
last_name: ''
password: pbkdf2_sha256$10000$LoeTDV2yMCWT$fgkQ++r4O7wurfFSAtHT1/a9WTjb32cHq63dFgXU+rI=
user_permissions: []
Expand Down Expand Up @@ -60,32 +60,52 @@
- fields: {contact: 1, message: 4, site: 1}
model: nuntium.outboundmessage
pk: 5
- fields: {url: 'http://popit.org/api/v1'}
model: popit.apiinstance
- fields:
url: 'http://popit.org/api/v1'
model: popolo_sources.popolosource
pk: 1
- fields: {url: 'http://popit.mysociety.org/api/v1/'}
model: popit.apiinstance
- fields:
url: 'http://popit.mysociety.org/api/v1/'
model: popolo_sources.popolosource
pk: 2
- fields: {api_instance: 1, name: Pedro, popit_url: 'http://popit.mysociety.org/api/v1/persons/1', popit_id: '52bc7asdasd34567'}
model: popit.person

- model: popolo_sources.linktopopolosource
fields:
popolo_source: 1
deleted_from_source: false
content_type: [popolo, person]
object_id: 1
pk: 1
- fields: {api_instance: 2, name: Marcel, popit_url: 'http://popit.mysociety.org/api/v1/persons/2', popit_id: '52bc7asdasd34568'}
model: popit.person
- model: popolo_sources.linktopopolosource
fields:
popolo_source: 2
deleted_from_source: false
content_type: [popolo, person]
object_id: 2
pk: 2
- fields: {api_instance: 2, name: Felipe, popit_url: 'http://popit.mysociety.org/api/v1/persons/3', popit_id: '52bc7asdasd34569'}
model: popit.person
pk: 3
- fields: {content: Public Answer,message: 2,person: 1}
model: nuntium.answer
- model: popolo_sources.linktopopolosource
fields:
popolo_source: 2
deleted_from_source: false
content_type: [popolo, person]
object_id: 3
pk: 2


- fields: {name: Pedro}
model: popolo.person
pk: 1
- fields: {content: Private Answer,message: 3,person: 1}
model: nuntium.answer
- fields: {name: Marcel}
model: popolo.person
pk: 2
- fields: {name: Felipe}
model: popolo.person
pk: 3
- fields: {person: 1, writeitinstance: 1}
model: instance.membership
model: instance.instancemembership
pk: 1
- fields: {person: 1, writeitinstance: 2}
model: instance.membership
model: instance.instancemembership
pk: 2
- fields: {label_name: Electronic Mail, name: e-mail}
model: contactos.contacttype
Expand All @@ -102,3 +122,72 @@
- fields: {contact_type: 1, person: 3, value: falvarez@ciudadanointeligente.cl, writeitinstance: 1}
model: contactos.contact
pk: 4
- fields:
content_type: [popolo, person]
identifier: 52bc7asdasd34567
object_id: 1
scheme: popit_id
model: popolo.identifier
pk: 1
- fields:
content_type: [popolo, person]
identifier: http://popit.mysociety.org/api/v1/persons/1
object_id: 1
scheme: popit_url
model: popolo.identifier
pk: 2
- fields:
content_type: [popolo, person]
identifier: 52bc7asdasd34567
object_id: 1
scheme: popolo:person
model: popolo.identifier
pk: 3
- fields:
content_type: [popolo, person]
identifier: 52bc7asdasd34568
object_id: 2
scheme: popit_id
model: popolo.identifier
pk: 4
- fields:
content_type: [popolo, person]
identifier: http://popit.mysociety.org/api/v1/persons/2
object_id: 2
scheme: popit_url
model: popolo.identifier
pk: 5
- fields:
content_type: [popolo, person]
identifier: 52bc7asdasd34568
object_id: 2
scheme: popolo:person
model: popolo.identifier
pk: 6
- fields:
content_type: [popolo, person]
identifier: 52bc7asdasd34569
object_id: 3
scheme: popit_id
model: popolo.identifier
pk: 7
- fields:
content_type: [popolo, person]
identifier: http://popit.mysociety.org/api/v1/persons/3
object_id: 3
scheme: popit_url
model: popolo.identifier
pk: 8
- fields:
content_type: [popolo, person]
identifier: 52bc7asdasd34569
object_id: 3
scheme: popolo:person
model: popolo.identifier
pk: 9
- fields: {content: Public Answer,message: 2,person: 1}
model: nuntium.answer
pk: 1
- fields: {content: Private Answer,message: 3,person: 1}
model: nuntium.answer
pk: 2
1 change: 0 additions & 1 deletion global_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from tastypie.test import ResourceTestCase
from django.conf import settings
from django.contrib.sites.models import Site
from popit.tests import instance_helpers
import os
import subprocess
import threading
Expand Down
Empty file added instance/management/__init__.py
Empty file.
Empty file.
Loading