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

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
Florent Chehab's avatar
Florent Chehab committed
15
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
Florent Chehab's avatar
Florent Chehab committed
16
17
18
    ]

    operations = [
Florent Chehab's avatar
Florent Chehab committed
19
20
21
22
23
24
25
26
27
        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)),
                ('local_name', models.CharField(max_length=200, null=True)),
                ('area', models.CharField(max_length=200, null=True)),
            ],
        ),
Florent Chehab's avatar
Florent Chehab committed
28
        migrations.CreateModel(
Florent Chehab's avatar
Florent Chehab committed
29
30
31
            name='Country',
            fields=[
                ('name', models.CharField(max_length=200)),
Florent Chehab's avatar
Florent Chehab committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
                ('iso_alpha3_code', models.CharField(max_length=3, primary_key=True, serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='MainCampus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('modified_date', models.DateTimeField(auto_now=True)),
                ('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')),
                ('modified_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            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)),
                ('parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='rex.Region')),
Florent Chehab's avatar
Florent Chehab committed
57
58
59
60
            ],
        ),
        migrations.CreateModel(
            name='University',
Florent Chehab's avatar
Florent Chehab committed
61
62
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
Florent Chehab's avatar
Florent Chehab committed
63
64
65
                ('name', models.CharField(max_length=200)),
                ('acronym', models.CharField(max_length=20)),
                ('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
66
                ('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
67
68
            ],
        ),
Florent Chehab's avatar
Florent Chehab committed
69
70
71
72
73
74
75
76
77
78
        migrations.AddField(
            model_name='country',
            name='region',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='rex.Region'),
        ),
        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
79
    ]