0001_initial.py 3.4 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
# Generated by Django 2.0.3 on 2018-04-25 14:48
Florent Chehab's avatar
Florent Chehab committed
2

Florent Chehab's avatar
Florent Chehab committed
3
import django.core.validators
Florent Chehab's avatar
Florent Chehab committed
4
from django.db import migrations, models
Florent Chehab's avatar
Florent Chehab committed
5
import django.db.models.deletion
Florent Chehab's avatar
Florent Chehab committed
6
import rex.utils.friendly_path
Florent Chehab's avatar
Florent Chehab committed
7
8
9
10
11
12
13
14
15
16


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
Florent Chehab's avatar
Florent Chehab committed
17
18
19
20
21
        migrations.CreateModel(
            name='City',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
22
23
                ('local_name', models.CharField(blank=True, max_length=200, null=True)),
                ('area', models.CharField(blank=True, max_length=200, null=True)),
Florent Chehab's avatar
Florent Chehab committed
24
25
            ],
        ),
Florent Chehab's avatar
Florent Chehab committed
26
        migrations.CreateModel(
Florent Chehab's avatar
Florent Chehab committed
27
28
29
            name='Country',
            fields=[
                ('name', models.CharField(max_length=200)),
30
                ('iso_alpha2_code', models.CharField(max_length=2, primary_key=True, serialize=False)),
Florent Chehab's avatar
Florent Chehab committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
            ],
        ),
        migrations.CreateModel(
            name='MainCampus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, null=True)),
                ('comment', models.TextField(blank=True, null=True)),
                ('lat', models.DecimalField(decimal_places=6, max_digits=10, validators=[django.core.validators.MinValueValidator(-85.05112878), django.core.validators.MaxValueValidator(85.05112878)])),
                ('lon', models.DecimalField(decimal_places=6, max_digits=10, validators=[django.core.validators.MinValueValidator(-180), django.core.validators.MaxValueValidator(180)])),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rex.City')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Region',
            fields=[
                ('name', models.CharField(max_length=200)),
                ('un_code', models.CharField(max_length=3, primary_key=True, serialize=False)),
52
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='rex.Region')),
Florent Chehab's avatar
Florent Chehab committed
53
54
55
56
            ],
        ),
        migrations.CreateModel(
            name='University',
Florent Chehab's avatar
Florent Chehab committed
57
58
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
Florent Chehab's avatar
Florent Chehab committed
59
                ('name', models.CharField(max_length=200)),
Florent Chehab's avatar
Florent Chehab committed
60
                ('acronym', models.CharField(blank=True, max_length=20, null=True)),
Florent Chehab's avatar
Florent Chehab committed
61
                ('logo', models.ImageField(default='path/to/my/default/image.jpg', max_length=250, upload_to=rex.utils.friendly_path.friendly_path('uploads/universities/logos/', 'name'))),
Florent Chehab's avatar
Florent Chehab committed
62
                ('main_campus', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, related_name='main_campus_of', to='rex.MainCampus')),
Florent Chehab's avatar
Florent Chehab committed
63
64
            ],
        ),
Florent Chehab's avatar
Florent Chehab committed
65
66
67
        migrations.AddField(
            model_name='country',
            name='region',
68
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='rex.Region'),
Florent Chehab's avatar
Florent Chehab committed
69
70
71
72
73
74
        ),
        migrations.AddField(
            model_name='city',
            name='country',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rex.Country'),
        ),
Florent Chehab's avatar
Florent Chehab committed
75
    ]