...
 
Commits (304)
......@@ -17,3 +17,7 @@ UPDATE staf_material SET parent_id = 970921 WHERE id = 971057;
SELECT setval('core_organization_id_seq', (SELECT MAX(id) FROM core_organization)+1);
SELECT setval('multiplicity_datasettypestructure_id_seq', (SELECT MAX(id) FROM multiplicity_datasettypestructure)+1);
SELECT setval('multiplicity_datasettype_id_seq', (SELECT MAX(id) FROM multiplicity_datasettype)+1);
INSERT INTO "core_useraction" ("id", "name") VALUES ('5', 'Data imported');
UPDATE staf_material SET code = CONCAT('HS',code) WHERE catalog_id = 1 AND parent_id != 970753;
<!DOCTYPE html>
<html>
<head>
<title>Redirecting...</title>
<meta http-equiv="refresh" content="7">
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
width: 100%;
display: table;
font-weight: 100;
font-family: 'Lato', sans-serif;
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 56px;
}
.subtitle {
font-size: 36px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<div class="title">Update in progress</div>
<div class="subtitle">
We are applying a system update; this page will refresh in 5 seconds, please stay tuned.
</div>
</div>
</div>
</body>
</html>
......@@ -11,6 +11,9 @@ class ArticleAdmin(admin.ModelAdmin):
class PeopleAdmin(admin.ModelAdmin):
list_display = ('firstname', 'lastname', 'city', 'email')
class ReferenceAdmin(admin.ModelAdmin):
search_fields = ['title']
admin.site.register(Journal)
admin.site.register(Publisher)
admin.site.register(Organization)
......@@ -23,3 +26,5 @@ admin.site.register(UserLog)
admin.site.register(People, PeopleAdmin)
admin.site.register(Timeline)
admin.site.register(Project)
admin.site.register(ReferenceType)
admin.site.register(Reference, ReferenceAdmin)
# Generated by Django 2.1.3 on 2019-02-03 13:20
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0035_auto_20190120_1000'),
]
operations = [
migrations.AlterField(
model_name='userlog',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='log', to=settings.AUTH_USER_MODEL),
),
]
# Generated by Django 2.1.3 on 2019-02-03 14:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0036_auto_20190203_1320'),
]
operations = [
migrations.AlterModelOptions(
name='reference',
options={'ordering': ['-year', 'title']},
),
migrations.AlterModelOptions(
name='userlog',
options={'ordering': ['-date']},
),
migrations.AddField(
model_name='userlog',
name='model_id',
field=models.PositiveIntegerField(blank=True, null=True),
),
]
# Generated by Django 2.1.3 on 2019-02-05 05:45
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0037_auto_20190203_1412'),
]
operations = [
migrations.CreateModel(
name='PeopleNote',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField()),
('note', models.TextField(blank=True, null=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['date'],
},
),
migrations.AlterField(
model_name='people',
name='status',
field=models.CharField(choices=[('active', 'Active'), ('retired', 'Retired'), ('deceased', 'Deceased'), ('inactive', 'Inactive'), ('pending', 'Pending Review')], default='active', max_length=8),
),
migrations.AddField(
model_name='peoplenote',
name='people',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.People'),
),
]
# Generated by Django 2.1.3 on 2019-02-05 06:09
import django.contrib.sites.managers
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('sites', '0002_alter_domain_unique'),
('core', '0038_auto_20190205_0545'),
]
operations = [
migrations.AlterModelManagers(
name='people',
managers=[
('objects', django.db.models.manager.Manager()),
('on_site', django.contrib.sites.managers.CurrentSiteManager()),
],
),
migrations.AddField(
model_name='people',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
preserve_default=False,
),
migrations.AlterField(
model_name='peoplenote',
name='date',
field=models.DateTimeField(auto_now_add=True),
),
]
# Generated by Django 2.1.3 on 2019-02-05 09:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0039_auto_20190205_0609'),
]
operations = [
migrations.AlterField(
model_name='people',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
]
# Generated by Django 2.1.3 on 2019-02-05 15:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0040_auto_20190205_0908'),
]
operations = [
migrations.AlterField(
model_name='video',
name='website',
field=models.CharField(choices=[('youtube', 'YouTube'), ('vimeo', 'Vimeo')], max_length=20),
),
]
# Generated by Django 2.1.3 on 2019-02-05 15:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0041_auto_20190205_1529'),
]
operations = [
migrations.AlterField(
model_name='article',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='video',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='videocollection',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
]
# Generated by Django 2.1.3 on 2019-02-06 03:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0042_auto_20190205_1553'),
]
operations = [
migrations.AlterField(
model_name='project',
name='thesistype',
field=models.CharField(blank=True, choices=[('bachelor', 'Bachelor'), ('masters', 'Master'), ('phd', 'PhD')], max_length=20, null=True),
),
migrations.AlterField(
model_name='video',
name='website',
field=models.CharField(choices=[('youtube', 'YouTube'), ('vimeo', 'Vimeo'), ('wikimedia', 'Wikimedia Commons'), ('other', 'Other website')], max_length=20),
),
]
# Generated by Django 2.1.3 on 2019-02-08 18:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0043_auto_20190206_0350'),
]
operations = [
migrations.AlterField(
model_name='project',
name='thesistype',
field=models.CharField(blank=True, choices=[('bachelor', 'Bachelor'), ('masters', 'Master'), ('phd', 'PhD'), ('other', 'Other')], max_length=20, null=True),
),
]
# Generated by Django 2.1.3 on 2019-02-10 11:47
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0044_auto_20190208_1813'),
]
operations = [
migrations.AlterField(
model_name='tag',
name='parent_tag',
field=models.ForeignKey(blank=True, limit_choices_to={'hidden': False}, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child', to='core.Tag'),
),
]
# Generated by Django 2.1.3 on 2019-02-10 11:47
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0045_auto_20190210_1147'),
]
operations = [
migrations.AlterField(
model_name='tag',
name='parent_tag',
field=models.ForeignKey(blank=True, limit_choices_to={'hidden': False}, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='core.Tag'),
),
]
# Generated by Django 2.1.3 on 2019-02-12 04:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0046_auto_20190210_1147'),
]
operations = [
migrations.AlterModelOptions(
name='people',
options={'ordering': ['firstname', 'lastname']},
),
]
# Generated by Django 2.1.3 on 2019-02-12 05:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0047_auto_20190212_0403'),
]
operations = [
migrations.AddField(
model_name='videocollection',
name='show_in_list',
field=models.BooleanField(default=True),
),
]
# Generated by Django 2.1.3 on 2019-02-12 07:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0048_videocollection_show_in_list'),
]
operations = [
migrations.AddField(
model_name='article',
name='head',
field=models.TextField(blank=True, null=True),
),
]
# Generated by Django 2.1.3 on 2019-02-12 07:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0049_article_head'),
]
operations = [
migrations.AddField(
model_name='article',
name='includes_form',
field=models.BooleanField(default=False),
),
]
# Generated by Django 2.1.3 on 2019-02-12 13:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0050_article_includes_form'),
]
operations = [
migrations.AlterField(
model_name='project',
name='type',
field=models.CharField(choices=[('theses', 'Theses'), ('projects', 'Projects'), ('applied', 'Applied research')], max_length=20),
),
]
# Generated by Django 2.1.3 on 2019-02-12 13:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0051_auto_20190212_1334'),
]
operations = [
migrations.AddField(
model_name='event',
name='estimated_date',
field=models.CharField(blank=True, max_length=60, null=True),
),
]
# Generated by Django 2.1.3 on 2019-03-04 07:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0052_event_estimated_date'),
]
operations = [
migrations.AlterField(
model_name='article',
name='site',
field=models.ForeignKey(default=2, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='people',
name='site',
field=models.ForeignKey(default=2, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='video',
name='site',
field=models.ForeignKey(default=2, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='videocollection',
name='site',
field=models.ForeignKey(default=2, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
]
# Generated by Django 2.1.3 on 2019-03-05 16:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0053_auto_20190304_0733'),
]
operations = [
migrations.AlterField(
model_name='article',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='people',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='video',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='videocollection',
name='site',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
]
# Generated by Django 2.1.3 on 2019-04-15 15:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0054_auto_20190305_1613'),
]
operations = [
migrations.CreateModel(
name='ReferenceAuthors',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('people', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.People')),
],
options={
'db_table': 'core_reference_authors',
},
),
migrations.AlterField(
model_name='reference',
name='authors',
field=models.ManyToManyField(through='core.ReferenceAuthors', to='core.People'),
),
migrations.AddField(
model_name='referenceauthors',
name='reference',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Reference'),
),
]
# Generated by Django 2.1.3 on 2019-04-19 06:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('staf', '0013_csv_active'),
('core', '0055_auto_20190415_1548'),
]
operations = [
migrations.AddField(
model_name='reference',
name='materials',
field=models.ManyToManyField(blank=True, to='staf.Material'),
),
migrations.AlterField(
model_name='reference',
name='primary_space',
field=models.CharField(blank=True, max_length=6, null=True),
),
]
# Generated by Django 2.1.3 on 2019-04-19 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0048_photo_position'),
('core', '0056_auto_20190419_0657'),
]
operations = [
migrations.RemoveField(
model_name='reference',
name='primary_space',
),
migrations.AddField(
model_name='reference',
name='spaces',
field=models.ManyToManyField(blank=True, to='multiplicity.ReferenceSpace'),
),
]
# Generated by Django 2.1.3 on 2019-04-24 15:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0057_auto_20190419_0709'),
]
operations = [
migrations.AlterModelOptions(
name='videocollection',
options={'ordering': ['position']},
),
migrations.AddField(
model_name='videocollection',
name='position',
field=models.PositiveSmallIntegerField(default=1),
),
]
# Generated by Django 2.1.3 on 2019-04-25 07:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0058_auto_20190424_1552'),
]
operations = [
migrations.RemoveField(
model_name='video',
name='collection',
),
migrations.AddField(
model_name='video',
name='collection',
field=models.ManyToManyField(blank=True, to='core.VideoCollection'),
),
]
# Generated by Django 2.1.3 on 2019-04-25 08:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0059_auto_20190425_0755'),
]
operations = [
migrations.RenameField(
model_name='video',
old_name='collection',
new_name='collections',
),
]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -29,6 +29,7 @@ ALLOWED_HOSTS = ['localhost', 'web']
# MoC = 1, MoI = 2
SITE_ID = 1
SITE_EMAIL = '[email protected]'
# Application definition
INSTALLED_APPS = [
......
......@@ -4,11 +4,15 @@ from .models import Topic, DatasetType, ReferenceSpace, ReferenceSpaceType, Refe
class ReferenceSpaceTypeAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
class TopicAdmin(admin.ModelAdmin):
list_display = ('name', 'parent', 'position', 'deleted')
class ReferenceSpaceAdmin(admin.ModelAdmin):
list_display = ('name', 'type')
search_fields = ['name']
admin.site.register(DatasetType)
admin.site.register(Topic)
admin.site.register(Topic, TopicAdmin)
admin.site.register(DQIRating)
admin.site.register(DQI)
admin.site.register(ReferenceSpace, ReferenceSpaceAdmin)
......
from django.contrib.sites.models import Site
from core.models import Event
from core.models import Event, Article
from multiplicity.models import ProcessGroup
from datetime import datetime, timedelta, time
from django.conf import settings
def site(request):
site = Site.objects.get_current()
today = datetime.now().date()
event = Event.objects.filter(article__site=site, start__gte=today).order_by('start').first()
event = Event.objects.filter(article__site=site, article__active=True, start__gte=today).order_by('start').first()
if site.id == 1:
news = 61
system = "city"
systems = "cities"
multiplicity_name = "Cities"
else:
news = 142
system = "island"
systems = "islands"
multiplicity_name = "Data"
latest_news = Article.objects.filter(parent=news, active=True).order_by('-date')[0]
processgroups = ProcessGroup.objects.order_by('name').exclude(pk__in=[13,14,12])
return {'SITE_ID': site.id, 'SITE_URL': site.domain, 'SITE_NAME': site.name, 'EVENT': event, 'PROCESSGROUPS': processgroups, 'MAPBOX_API_KEY': "pk.eyJ1IjoibWV0YWJvbGlzbW9mY2l0aWVzIiwiYSI6ImNqcHA5YXh6aTAxcmY0Mm8yMGF3MGZjdGcifQ.lVZaiSy76Om31uXLP3hw-Q"}
return {
'SITE_ID': site.id,
'SITE_URL': site.domain,
'SITE_NAME': site.name,
'EVENT': event,
'PROCESSGROUPS': processgroups,
'MAPBOX_API_KEY': "pk.eyJ1IjoibWV0YWJvbGlzbW9mY2l0aWVzIiwiYSI6ImNqcHA5YXh6aTAxcmY0Mm8yMGF3MGZjdGcifQ.lVZaiSy76Om31uXLP3hw-Q",
'DEBUG': settings.DEBUG,
'CURRENT_PAGE': request.get_full_path(),
'LATEST_NEWS': latest_news,
'SYSTEM': system,
'SYSTEMS': systems,
'MULTIPLICITY_NAME': multiplicity_name,
}
# Generated by Django 2.1.3 on 2019-01-27 17:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0036_information_topic'),
]
operations = [
migrations.AlterModelOptions(
name='referencespacelocation',
options={'ordering': ['-timeframe']},
),
migrations.AddField(
model_name='referencespacelocation',
name='area',
field=models.FloatField(blank=True, null=True),
),
]
# Generated by Django 2.1.3 on 2019-01-29 08:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0037_auto_20190127_1746'),
]
operations = [
migrations.CreateModel(
name='MTU',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timeframe', models.CharField(max_length=255)),
('source', models.CharField(max_length=255)),
('file', models.CharField(max_length=255)),
('description', models.TextField()),
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='multiplicity.ReferenceSpace')),
('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='multiplicity.ReferenceSpaceType')),
],
),
]
# Generated by Django 2.1.3 on 2019-01-29 11:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0038_mtu'),
]
operations = [
migrations.AlterModelOptions(
name='license',
options={'ordering': ['name']},
),
migrations.AddField(
model_name='photo',
name='type',
field=models.CharField(choices=[('photo', 'Photo'), ('map', 'Map')], default='photo', max_length=6),
),
]
# Generated by Django 2.1.3 on 2019-01-29 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0039_auto_20190129_1123'),
]
operations = [
migrations.AlterField(
model_name='photo',
name='type',
field=models.CharField(choices=[('photo', 'Photo'), ('map', 'Map')], default='photo', max_length=6),
),
]
# Generated by Django 2.1.3 on 2019-01-30 20:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0040_auto_20190129_1125'),
]
operations = [
migrations.AddField(
model_name='referencespace',
name='mtu',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='multiplicity.MTU'),
),
migrations.AlterField(
model_name='mtu',
name='space',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='mtu_list', to='multiplicity.ReferenceSpace'),
),
]
# Generated by Django 2.1.3 on 2019-02-09 17:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0041_auto_20190130_2020'),
]
operations = [
migrations.CreateModel(
name='ReferenceSpaceSector',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sectors', to='multiplicity.ReferenceSpace')),
],
),
migrations.AddField(
model_name='topic',
name='color',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='referencespacesector',
name='topic',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='multiplicity.Topic'),
),
]
# Generated by Django 2.1.3 on 2019-02-09 17:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0042_auto_20190209_1716'),
]
operations = [
migrations.RemoveField(
model_name='referencespacesector',
name='topic',
),
migrations.AddField(
model_name='referencespacesector',
name='process_group',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='multiplicity.ProcessGroup'),
preserve_default=False,
),
]
# Generated by Django 2.1.3 on 2019-03-04 07:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0043_auto_20190209_1723'),
]
operations = [
migrations.AddField(
model_name='referencespacelocation',
name='active',
field=models.BooleanField(db_index=True, default=True),
),
]
# Generated by Django 2.1.3 on 2019-03-04 07:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0044_referencespacelocation_active'),
]
operations = [
migrations.AddField(
model_name='mtu',
name='active',
field=models.BooleanField(db_index=True, default=True),
),
migrations.AddField(
model_name='referencespace',
name='active',
field=models.BooleanField(db_index=True, default=True),
),
]
# Generated by Django 2.1.3 on 2019-03-20 05:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0045_auto_20190304_0737'),
]
operations = [
migrations.AddField(
model_name='referencespacelocation',
name='end',
field=models.DateField(blank=True, db_index=True, null=True),
),
migrations.AddField(
model_name='referencespacelocation',
name='start',
field=models.DateField(blank=True, db_index=True, null=True),
),
]
# Generated by Django 2.1.3 on 2019-03-20 05:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0046_auto_20190320_0539'),
]
operations = [
migrations.AlterModelOptions(
name='referencespacelocation',
options={'ordering': ['-start']},
),
migrations.RemoveField(
model_name='referencespacelocation',
name='timeframe',
),
]
# Generated by Django 2.1.3 on 2019-04-06 04:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0047_auto_20190320_0544'),
]
operations = [
migrations.AddField(
model_name='photo',
name='position',
field=models.PositiveSmallIntegerField(default=99),
),
]
# Generated by Django 2.1.3 on 2019-04-19 09:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('multiplicity', '0048_photo_position'),
]
operations = [
migrations.AddField(
model_name='referencespace',
name='parent',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child', to='multiplicity.ReferenceSpace'),
),
]
......@@ -9,6 +9,9 @@ from django.forms import ModelForm
from stdimage.models import StdImageField
import re
# For absolute URL reversing
from django.urls import reverse
User = get_user_model()
class TimestampedModel(models.Model):
......@@ -30,6 +33,7 @@ class TimestampedModel(models.Model):
class Topic(models.Model):
name = models.CharField(max_length=255)
icon = models.CharField(max_length=255, null=True, blank=True)
color = models.CharField(max_length=255, null=True, blank=True)
slug = models.SlugField(db_index=True, max_length=255, unique=True)
parent = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children')
position = models.PositiveSmallIntegerField()
......@@ -121,30 +125,46 @@ class DatasetTypeForm(ModelForm):
model = DatasetType
fields = ['name', 'description', 'flows', 'type', 'category', 'topic', 'slug', 'active']
class ReferenceSpace(models.Model):
name = models.CharField(max_length=255, db_index=True)
type = models.ForeignKey(ReferenceSpaceType, on_delete=models.CASCADE)
city = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='city_location')
country = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='country_location')
parent = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='child')
description = models.TextField(null=True, blank=True)
url = models.CharField(max_length=255, null=True, blank=True)
slug = models.SlugField(db_index=True, max_length=255, null=True)
location = models.ForeignKey('multiplicity.ReferenceSpaceLocation', on_delete=models.SET_NULL, null=True, blank=True)
csv = models.ForeignKey('multiplicity.ReferenceSpaceCSV', on_delete=models.CASCADE, null=True, blank=True)
tag = models.ForeignKey('core.Tag', on_delete=models.CASCADE, null=True, blank=True)
mtu = models.ForeignKey('multiplicity.MTU', on_delete=models.CASCADE, null=True, blank=True)
active = models.BooleanField(default=True, db_index=True)
def __str__(self):
return self.name + " (" + self.type.name + ")"
def save(self, *args, **kwargs):
if not self.id:
# Newly created object, so set slug
self.slug = slugify(self.name)
super(ReferenceSpace, self).save(*args, **kwargs)
def system_photo(self):
photo = Photo.objects.filter(primary_space=self, secondary_space__isnull=True, process__isnull=True, deleted=False).order_by('position')
if photo:
return photo[0]
class Meta:
ordering = ["name"]
def get_absolute_url(self):
if self.mtu:
return reverse("multiplicity:mtu_space", args=[self.city.slug, self.type.slug, self.slug])
elif self.city:
return reverse("multiplicity:map", args=[self.city.slug])
else:
return reverse("multiplicity:map", args=[self.slug])
class ReferenceSpaceForm(ModelForm):
class Meta:
model = ReferenceSpace
......@@ -155,15 +175,18 @@ class ReferenceSpaceLocation(models.Model):
space = models.ForeignKey(ReferenceSpace, on_delete=models.CASCADE)
lat = models.CharField(max_length=20, null=True, blank=True)
lng = models.CharField(max_length=20, null=True, blank=True)
area = models.FloatField(null=True, blank=True)
default_zoom = models.PositiveSmallIntegerField(null=True, blank=True)
description = models.TextField(null=True, blank=True)
timeframe = models.CharField(max_length=255, null=True, blank=True)
start = models.DateField(null=True, blank=True, db_index=True)
end = models.DateField(null=True, blank=True, db_index=True)
source = models.CharField(max_length=255, null=True, blank=True)
geojson = models.TextField(null=True, blank=True)
active = models.BooleanField(default=True, db_index=True)
def __str__(self):
return self.name or 'Location for ' + self.space.name
class Meta:
ordering = ["name"]
ordering = ["-start"]
class ReferenceSpaceLocationForm(ModelForm):