Skip to content
Extraits de code Groupes Projets
Valider 178f5053 rédigé par Nicolas Joyard's avatar Nicolas Joyard
Parcourir les fichiers

Fix mandate.role field length + constituency fingerprint

parent 7e361a9d
Branches
Étiquettes
Aucune requête de fusion associée trouvée
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def migrate_constituencies(apps, schema_editor):
"""
Re-save constituencies to recompute fingerprints
"""
Constituency = apps.get_model("representatives", "Constituency")
for c in Constituency.objects.all():
c.save()
class Migration(migrations.Migration):
dependencies = [
('representatives', '0016_chamber_migrate_data'),
]
operations = [
migrations.AlterField(
model_name='mandate',
name='role',
field=models.CharField(default=b'', help_text=b'Eg.: president of a political group', max_length=255, blank=True),
),
migrations.RunPython(migrate_constituencies)
]
......@@ -201,7 +201,7 @@ class Constituency(HashableModel, TimeStampedModel):
country = models.ForeignKey('Country', null=True, blank=True,
related_name='constituencies')
hashable_fields = ['name']
hashable_fields = ['name', 'country']
@cached_property
def active(self):
......@@ -230,7 +230,7 @@ class Mandate(HashableModel, TimeStampedModel):
Constituency, null=True, related_name='mandates')
representative = models.ForeignKey(Representative, related_name='mandates')
role = models.CharField(
max_length=25,
max_length=255,
blank=True,
default='',
help_text="Eg.: president of a political group"
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter