0001_initial.py 3.81 KB
Newer Older
1
# Generated by Django 2.0.3 on 2018-08-19 16:39
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 = [
17
18
19
20
21
22
23
24
25
26
27
        migrations.CreateModel(
            name='Campus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_main_campus', models.BooleanField()),
                ('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)])),
            ],
        ),
Florent Chehab's avatar
Florent Chehab committed
28
29
30
31
32
        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)),
33
34
                ('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
35
36
            ],
        ),
Florent Chehab's avatar
Florent Chehab committed
37
        migrations.CreateModel(
Florent Chehab's avatar
Florent Chehab committed
38
39
40
            name='Country',
            fields=[
                ('name', models.CharField(max_length=200)),
41
                ('iso_alpha2_code', models.CharField(max_length=2, primary_key=True, serialize=False)),
42
43
44
45
46
47
48
                ('iso_alpha3_code', models.CharField(max_length=3, unique=True)),
                ('region_name', models.CharField(max_length=200)),
                ('region_un_code', models.CharField(max_length=3)),
                ('sub_region_name', models.CharField(blank=True, max_length=200, null=True)),
                ('sub_region_un_code', models.CharField(blank=True, max_length=3, null=True)),
                ('intermediate_region_name', models.CharField(blank=True, max_length=200, null=True)),
                ('intermediate_region_un_code', models.CharField(blank=True, max_length=3, null=True)),
Florent Chehab's avatar
Florent Chehab committed
49
50
            ],
        ),
Florent Chehab's avatar
Florent Chehab committed
51
52
        migrations.CreateModel(
            name='University',
Florent Chehab's avatar
Florent Chehab committed
53
54
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
Florent Chehab's avatar
Florent Chehab committed
55
                ('name', models.CharField(max_length=200)),
Florent Chehab's avatar
Florent Chehab committed
56
                ('acronym', models.CharField(blank=True, max_length=20, null=True)),
Florent Chehab's avatar
Florent Chehab committed
57
                ('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'))),
58
                ('website', models.URLField(null=True)),
Florent Chehab's avatar
Florent Chehab committed
59
            ],
60
61
62
            options={
                'abstract': False,
            },
Florent Chehab's avatar
Florent Chehab committed
63
        ),
Florent Chehab's avatar
Florent Chehab committed
64
65
66
67
68
        migrations.AddField(
            model_name='city',
            name='country',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rex.Country'),
        ),
69
70
71
72
73
74
75
76
77
78
79
80
81
82
        migrations.AddField(
            model_name='campus',
            name='city',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rex.City'),
        ),
        migrations.AddField(
            model_name='campus',
            name='university',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='univCampus', to='rex.University'),
        ),
        migrations.AlterUniqueTogether(
            name='campus',
            unique_together={('is_main_campus', 'university')},
        ),
Florent Chehab's avatar
Florent Chehab committed
83
    ]