Commit c6a3f754 authored by luxcem's avatar luxcem

fixes models

parent 079ea49f
......@@ -29,6 +29,16 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Constituency',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Country',
fields=[
......@@ -53,18 +63,27 @@ class Migration(migrations.Migration):
bases=(models.Model,),
),
migrations.CreateModel(
name='Mandate',
name='Group',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255)),
('abbreviation', models.CharField(max_length=10, null=True, blank=True)),
('kind', models.CharField(max_length=255, null=True, blank=True)),
('short_id', models.CharField(max_length=25, null=True, blank=True)),
('url', models.URLField()),
('constituency', models.CharField(help_text=b'Authority for which the mandate is realized. Eg.: a eurodeputies has a mandate at the European Parliament for a country', max_length=255, null=True, blank=True)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Mandate',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('role', models.CharField(help_text=b'Eg.: president of a political group at the European Parliament', max_length=25, null=True, blank=True)),
('begin_date', models.DateField(null=True, blank=True)),
('end_date', models.DateField(null=True, blank=True)),
('active', models.NullBooleanField(default=False)),
('link', models.URLField()),
('constituency', models.ForeignKey(related_name='mandates', to='representatives.Constituency', null=True)),
('group', models.ForeignKey(related_name='mandates', to='representatives.Group', null=True)),
],
options={
},
......@@ -74,9 +93,9 @@ class Migration(migrations.Migration):
name='Phone',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('number', models.CharField(max_length=255)),
('number', models.CharField(max_length=255, null=True, blank=True)),
('kind', models.CharField(max_length=255, null=True, blank=True)),
('address', models.ForeignKey(to='representatives.Address')),
('address', models.ForeignKey(related_name='phones', to='representatives.Address', null=True)),
],
options={
'abstract': False,
......@@ -88,7 +107,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('slug', models.SlugField(max_length=100)),
('remote_id', models.CharField(max_length=255, null=True, blank=True)),
('remote_id', models.CharField(unique=True, max_length=255)),
('first_name', models.CharField(max_length=255, null=True, blank=True)),
('last_name', models.CharField(max_length=255, null=True, blank=True)),
('full_name', models.CharField(max_length=255)),
......@@ -96,6 +115,8 @@ class Migration(migrations.Migration):
('birth_place', models.CharField(max_length=255, null=True, blank=True)),
('birth_date', models.DateField(null=True, blank=True)),
('cv', models.TextField(null=True, blank=True)),
('photo', models.CharField(max_length=512, null=True)),
('active', models.BooleanField(default=False)),
],
options={
},
......@@ -105,7 +126,7 @@ class Migration(migrations.Migration):
name='WebSite',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('url', models.URLField()),
('url', models.CharField(max_length=2048, null=True, blank=True)),
('kind', models.CharField(max_length=255, null=True, blank=True)),
('representative', models.ForeignKey(to='representatives.Representative')),
],
......@@ -123,7 +144,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='mandate',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
field=models.ForeignKey(related_name='mandates', to='representatives.Representative'),
preserve_default=True,
),
migrations.AddField(
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='representative',
name='photo',
field=models.CharField(max_length=512, null=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0002_representative_photo'),
]
operations = [
migrations.CreateModel(
name='Constituency',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Group',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255)),
('abbreviation', models.CharField(max_length=10, null=True, blank=True)),
('kind', models.CharField(max_length=255, null=True, blank=True)),
('active', models.BooleanField(default=False)),
],
options={
},
bases=(models.Model,),
),
migrations.RemoveField(
model_name='mandate',
name='kind',
),
migrations.RemoveField(
model_name='mandate',
name='name',
),
migrations.RemoveField(
model_name='mandate',
name='short_id',
),
migrations.AddField(
model_name='mandate',
name='group',
field=models.ForeignKey(to='representatives.Group', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='representative',
name='active',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.RemoveField(
model_name='mandate',
name='constituency'
),
migrations.AddField(
model_name='mandate',
name='constituency',
field=models.ForeignKey(to='representatives.Constituency', null=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0003_auto_20150311_1509'),
]
operations = [
migrations.AddField(
model_name='representative',
name='country',
field=models.ForeignKey(to='representatives.Country', null=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0004_representative_country'),
]
operations = [
migrations.RemoveField(
model_name='representative',
name='active',
),
migrations.RemoveField(
model_name='representative',
name='country',
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0005_auto_20150319_1620'),
]
operations = [
migrations.RemoveField(
model_name='group',
name='active',
),
migrations.RemoveField(
model_name='mandate',
name='active',
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0006_auto_20150320_1549'),
]
operations = [
migrations.AlterField(
model_name='address',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='email',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='mandate',
name='group',
field=models.ForeignKey(to='representatives.Group', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='mandate',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='phone',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='website',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0007_auto_20150323_1017'),
]
operations = [
migrations.AddField(
model_name='representative',
name='active',
field=models.BooleanField(default=False),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
import os
from django.core import serializers
fixture_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../fixtures'))
fixture_filename = 'initial_data.json'
def load_fixture(apps, schema_editor):
fixture_file = os.path.join(fixture_dir, fixture_filename)
fixture = open(fixture_file, 'rb')
objects = serializers.deserialize('json', fixture, ignorenonexistent=True)
for obj in objects:
obj.save()
fixture.close()
def unload_fixture(apps, schema_editor):
"Brutally deleting all entries for this model..."
MyModel = apps.get_model("representatives", "Country")
MyModel.objects.all().delete()
class Migration(migrations.Migration):
dependencies = [
('representatives', '0008_auto_20150422_0518'),
]
operations = [
migrations.RunPython(load_fixture, reverse_code=unload_fixture),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0009_auto_20150428_0455'),
]
operations = [
migrations.RenameField(
model_name='mandate',
old_name='url',
new_name='link',
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0010_auto_20150527_1401'),
]
operations = [
migrations.AlterField(
model_name='phone',
name='address',
field=models.ForeignKey(to='representatives.Address', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='phone',
name='number',
field=models.CharField(max_length=255, null=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0010_auto_20150527_1401'),
]
operations = [
migrations.AlterField(
model_name='mandate',
name='representative',
field=models.ForeignKey(related_name='mandates', to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='phone',
name='address',
field=models.ForeignKey(related_name='phones', to='representatives.Address', null=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0011_auto_20150528_1608'),
]
operations = [
migrations.AlterField(
model_name='phone',
name='number',
field=models.CharField(max_length=255, null=True, blank=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0012_auto_20150528_1611'),
]
operations = [
migrations.AlterField(
model_name='website',
name='url',
field=models.CharField(max_length=2048, null=True, blank=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0011_auto_20150529_1516'),
('representatives', '0013_auto_20150528_1617'),
]
operations = [
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0014_merge'),
]
operations = [
migrations.AlterField(
model_name='address',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='email',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='mandate',
name='group',
field=models.ForeignKey(to='representatives.Group', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='mandate',
name='representative',
field=models.ForeignKey(related_name='mandates', to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='phone',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
migrations.AlterField(
model_name='website',
name='representative',
field=models.ForeignKey(to='representatives.Representative'),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('representatives', '0015_auto_20150603_1216'),
]
operations = [
migrations.AlterField(
model_name='representative',
name='remote_id',
field=models.CharField(max_length=255, unique=True, null=True, blank=True),
preserve_default=True,
),
]
......@@ -39,7 +39,7 @@ class Representative(models.Model):
)
slug = models.SlugField(max_length=100)
remote_id = models.CharField(max_length=255, blank=True, null=True, unique=True)
remote_id = models.CharField(max_length=255, unique=True)
first_name = models.CharField(max_length=255, blank=True, null=True)
last_name = models.CharField(max_length=255, blank=True, null=True)
full_name = models.CharField(max_length=255)
......@@ -121,8 +121,9 @@ class Constituency(models.Model):
class Mandate(models.Model):
group = models.ForeignKey(Group, null=True)
constituency = models.ForeignKey(Constituency, null=True)