summaryrefslogtreecommitdiff
path: root/app/birds/migrations/0001_initial.py
blob: b20387e1fa2f92fde17d84abe3335f2b84b1ce89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-13 09:49
from __future__ import unicode_literals

import birds.models
from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        #('locations', '__first__'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Bird',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('common_name', models.CharField(max_length=200)),
                ('slug', models.SlugField()),
                ('scientific_name', models.CharField(max_length=200)),
                ('code', models.IntegerField(choices=[(1, 'regular occurring - common'), (2, 'regular occurring - less common'), (3, 'rare'), (4, 'casual'), (5, 'accidental'), (6, 'Cannot be found')], default=0)),
                ('image', models.FileField(blank=True, null=True, upload_to=birds.models.get_upload_path)),
            ],
            options={
                'ordering': ['common_name'],
            },
        ),
        migrations.CreateModel(
            name='BirdAudio',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('audio', models.FileField(upload_to='audio/birds/')),
                ('recorder', models.CharField(blank=True, max_length=200, null=True)),
                ('pub_date', models.DateTimeField()),
                ('location', models.CharField(blank=True, max_length=200, null=True)),
                ('link', models.CharField(blank=True, max_length=450, null=True)),
                ('copyright', models.CharField(blank=True, max_length=250, null=True)),
                ('bird', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='recordings', to='birds.Bird')),
            ],
            options={
                'ordering': ['bird'],
                'verbose_name_plural': 'Bird Audio',
            },
        ),
        migrations.CreateModel(
            name='BirdClass',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('common_name', models.CharField(max_length=200)),
                ('scientific_name', models.CharField(max_length=200)),
            ],
            options={
                'ordering': ['common_name'],
                'verbose_name_plural': 'Bird Class',
            },
        ),
        migrations.CreateModel(
            name='BirdSighting',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('point', django.contrib.gis.db.models.fields.PointField(srid=4326)),
                ('date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Date')),
                ('image', models.FileField(blank=True, null=True, upload_to=birds.models.get_upload_path)),
                ('bird', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='birds.Bird')),
                ('location', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')),
                ('seen_by', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Bird Sighting',
            },
        ),
        migrations.AddField(
            model_name='bird',
            name='bird_class',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='birds.BirdClass'),
        ),
    ]