Merge branch 'temp/migration' into develop
This commit is contained in:
commit
f4ae5c9f77
6
.gitignore
vendored
6
.gitignore
vendored
@ -65,12 +65,6 @@ coverage.xml
|
|||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
|
||||||
# Django stuff:
|
|
||||||
# exclude migrations from repository. These should be created locally, matching local DB requirements.
|
|
||||||
# lostplaces/manage.py makemigrations && lostplaces/manage.py migrate
|
|
||||||
|
|
||||||
django_lostplaces/lostplaces/migrations/
|
|
||||||
|
|
||||||
# pyenv
|
# pyenv
|
||||||
.python-version
|
.python-version
|
||||||
|
|
||||||
|
90
django_lostplaces/lostplaces/migrations/0001_initial.py
Normal file
90
django_lostplaces/lostplaces/migrations/0001_initial.py
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
# Generated by Django 3.1.1 on 2020-09-28 18:39
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import easy_thumbnails.fields
|
||||||
|
import lostplaces.models.place
|
||||||
|
import taggit.managers
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('taggit', '0003_taggeditem_add_unique_index'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Expireable',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('created_when', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('expires_when', models.DateTimeField()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Explorer',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='explorer', to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Place',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=50)),
|
||||||
|
('latitude', models.FloatField(validators=[django.core.validators.MinValueValidator(-90), django.core.validators.MaxValueValidator(90)])),
|
||||||
|
('longitude', models.FloatField(validators=[django.core.validators.MinValueValidator(-180), django.core.validators.MaxValueValidator(180)])),
|
||||||
|
('submitted_when', models.DateTimeField(auto_now_add=True, null=True)),
|
||||||
|
('location', models.CharField(max_length=50)),
|
||||||
|
('description', models.TextField()),
|
||||||
|
('submitted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='places', to='lostplaces.explorer')),
|
||||||
|
('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Voucher',
|
||||||
|
fields=[
|
||||||
|
('expireable_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='lostplaces.expireable')),
|
||||||
|
('code', models.CharField(max_length=30, unique=True)),
|
||||||
|
],
|
||||||
|
bases=('lostplaces.expireable',),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='PlaceImage',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('submitted_when', models.DateTimeField(auto_now_add=True, null=True)),
|
||||||
|
('description', models.TextField(blank=True)),
|
||||||
|
('filename', easy_thumbnails.fields.ThumbnailerImageField(upload_to=lostplaces.models.place.generate_image_upload_path)),
|
||||||
|
('place', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='placeimages', to='lostplaces.place')),
|
||||||
|
('submitted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='placeimages', to='lostplaces.explorer')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='PhotoAlbum',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('submitted_when', models.DateTimeField(auto_now_add=True, null=True)),
|
||||||
|
('url', models.URLField()),
|
||||||
|
('label', models.CharField(max_length=100)),
|
||||||
|
('place', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='photoalbums', to='lostplaces.place')),
|
||||||
|
('submitted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='photoalbums', to='lostplaces.explorer')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
0
django_lostplaces/lostplaces/migrations/__init__.py
Normal file
0
django_lostplaces/lostplaces/migrations/__init__.py
Normal file
1332
django_lostplaces/testdata/testdata.json
vendored
1332
django_lostplaces/testdata/testdata.json
vendored
File diff suppressed because it is too large
Load Diff
5
django_lostplaces/testdata/testdata.md
vendored
5
django_lostplaces/testdata/testdata.md
vendored
@ -1,5 +1,7 @@
|
|||||||
# testdata
|
# testdata
|
||||||
|
|
||||||
|
This testdata is provided for you to see the database filled with some dummycontent.
|
||||||
|
|
||||||
## Database content
|
## Database content
|
||||||
testdata is provided in this repository / directory in testdata.json. It has been
|
testdata is provided in this repository / directory in testdata.json. It has been
|
||||||
dumped using:
|
dumped using:
|
||||||
@ -8,7 +10,8 @@ dumped using:
|
|||||||
manage.py dumpdata --all --exclude=auth --exclude=sessions --indent 4 --o testdata/testdata.json
|
manage.py dumpdata --all --exclude=auth --exclude=sessions --indent 4 --o testdata/testdata.json
|
||||||
```
|
```
|
||||||
|
|
||||||
You can import it using
|
To successfully import this testdata, you have to create 2 users. ID=1 is your normal superuser, ID=2 is an unprivileged user.
|
||||||
|
You can import it using:
|
||||||
|
|
||||||
```
|
```
|
||||||
manage.py loaddata testdata.json
|
manage.py loaddata testdata.json
|
||||||
|
Loading…
Reference in New Issue
Block a user