-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
155: Military symbols for narrations. r=MiklerGM a=whirish Closes #94. Adds two models - `Symbol` and `SymbolFeature`. Symbol is intended to be a single FeatureCollection storing individual SymbolFeatures, and has a o2m relationship with SymbolFeature as a result. SymbolFeatures stores geometry and an hstore field `styling`, which will store styling information as GeoJSON `properties`. Symbol features have a GeoJSON-compatible endpoint, and can be requested as `/api/symbol-features/?symbol=<symbol id>/`, which returns a FeatureCollection containing all SymbolFeatures for a specified Symbol ID. @MiklerGM please tell me if this arrangement works for you. We can also add query params for filtering based on narration IDs, etc. Old Chronist narratives should be available for import after this is merged. Co-authored-by: whirish <lpoflynn@protonmail.ch>
- Loading branch information
Showing
9 changed files
with
185 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
project/api/migrations/0016_historicalsymbol_symbol_symbolfeature.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Generated by Django 2.2.4 on 2019-08-08 19:58 | ||
|
||
from django.conf import settings | ||
import django.contrib.gis.db.models.fields | ||
from django.contrib.postgres.operations import HStoreExtension | ||
import django.contrib.postgres.fields.hstore | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import simple_history.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('api', '0015_merge_20190627_1103'), | ||
] | ||
|
||
operations = [ | ||
HStoreExtension(), | ||
migrations.CreateModel( | ||
name='Symbol', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.TextField(max_length=50)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='SymbolFeature', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('geom', django.contrib.gis.db.models.fields.GeometryField(srid=4326)), | ||
('styling', django.contrib.postgres.fields.hstore.HStoreField()), | ||
('symbol', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='features', to='api.Symbol')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='HistoricalSymbol', | ||
fields=[ | ||
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), | ||
('name', models.TextField(max_length=50)), | ||
('history_id', models.AutoField(primary_key=True, serialize=False)), | ||
('history_date', models.DateTimeField()), | ||
('history_change_reason', models.CharField(max_length=100, null=True)), | ||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), | ||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'verbose_name': 'historical symbol', | ||
'ordering': ('-history_date', '-history_id'), | ||
'get_latest_by': 'history_date', | ||
}, | ||
bases=(simple_history.models.HistoricalChanges, models.Model), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.4 on 2019-08-08 23:07 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0016_historicalsymbol_symbol_symbolfeature'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='symbol', | ||
name='narration', | ||
field=models.ManyToManyField(related_name='symbols', to='api.Narration'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.4 on 2019-08-09 00:35 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0017_symbol_narration'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='symbol', | ||
old_name='narration', | ||
new_name='narrations', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters