Skip to content

Commit 95c42ea

Browse files
committed
Merged in stage (pull request #18)
release merge, snapshot legend (svg icons, collapsable), permissions for snapshot, not listed, workspaces
2 parents 632ade5 + 628f9c8 commit 95c42ea

File tree

24 files changed

+1089
-261
lines changed

24 files changed

+1089
-261
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
SHELL = /bin/bash
2+
13
.PHONY: all
24

35
init:
@@ -37,6 +39,19 @@ deploy_dev:
3739
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && COMPOSE_FILE=$$COMPOSE_DEV docker-compose exec django make migrate"
3840
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && COMPOSE_FILE=$$COMPOSE_DEV docker-compose exec django killall -TERM gunicorn"
3941

42+
deploy_local:
43+
docker-compose up -d
44+
make -f vue/Makefile build
45+
source env.hosts.prod && rsync -av --delete vue/dist $$VUE_LOCAL_PATH
46+
docker-compose exec -T django make migrate
47+
docker-compose exec -T django killall -TERM gunicorn
48+
49+
slack-push:
50+
source env.hosts.prod && test -v SLACK_APP_HOOK && curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"$$SLACK_APP_TEXT\"}" "https://hooks.slack.com/services/$$SLACK_APP_HOOK"
51+
52+
update:
53+
make deploy_local && make slack-push; exit 0
54+
4055
ab-graphql:
4156
ab -p tests/graphql-autocomplete-post.json -T application/json -c 10 -n 2000 http://gemeindescan.ch/graphql/
4257

django/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GEMEINDESCAN_WEBUI_DJANGO=0.3.1
1+
GEMEINDESCAN_WEBUI_DJANGO=0.3.3
22
DOCKER_EXEC=$(shell command -v docker > /dev/null && echo "docker-compose exec django")
33

44
.PHONY: all

django/docker/django/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ RUN apk --no-cache add yajl build-base yajl-dev python3-dev \
4848
&& pip3 install -r /tmp/requirements.txt \
4949
&& apk del build-base yajl-dev python3-dev
5050

51+
# python requirements 02 layer
52+
COPY ./requirements/02.txt /tmp/requirements.txt
53+
RUN cd /opt && pip3 install -r /tmp/requirements.txt
54+
5155
COPY s6/etc/services.d /etc/services.d
5256
COPY s6/etc/cont-init.d /etc/cont-init.d
5357
ENTRYPOINT ["/init"]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
aniso8601==7.0.0
2+
asgiref==3.2.3
3+
astroid==2.3.3
4+
attrs==19.3.0
5+
blessings==1.7
6+
bpython==0.18
7+
certifi==2019.11.28
8+
chardet==3.0.4
9+
Click==7.0
10+
curtsies==0.3.1
11+
Django==3.0.3
12+
django-cors-headers==3.2.1
13+
django-filter==2.2.0
14+
django-json-widget==1.0.0
15+
django-sortedm2m==3.0.0
16+
-e git+https://github.com/svleeuwen/sortedm2m-filter-horizontal-widget.git@4ce03f6b7e6022014838afb4a8aa4691fceb9e94#egg=django_sortedm2m_filter_horizontal_widget
17+
future==0.18.2
18+
graphene==2.1.8
19+
graphene-django==2.8.1
20+
graphql-core==2.2.1
21+
graphql-relay==2.0.1
22+
greenlet==0.4.15
23+
gunicorn==19.9.0
24+
h11==0.9.0
25+
httptools==0.0.13
26+
idna==2.9
27+
isort==4.3.21
28+
jsonslicer==0.1.5
29+
lazy-object-proxy==1.4.3
30+
mccabe==0.6.1
31+
more-itertools==8.2.0
32+
olefile==0.46
33+
packaging==20.1
34+
Pillow==6.2.1
35+
pluggy==0.13.1
36+
promise==2.3
37+
psycopg2==2.8.4
38+
py==1.8.1
39+
Pygments==2.5.2
40+
pylint==2.4.4
41+
pylint-django==2.0.13
42+
pylint-plugin-utils==0.6
43+
pyparsing==2.4.6
44+
pytest==5.3.5
45+
pytz==2019.3
46+
requests==2.23.0
47+
Rx==1.6.1
48+
singledispatch==3.4.0.3
49+
six==1.14.0
50+
sorl-thumbnail==12.6.3
51+
sqlparse==0.3.0
52+
urllib3==1.25.8
53+
uvicorn==0.11.2
54+
uvloop==0.14.0
55+
wcwidth==0.1.8
56+
websockets==8.1
57+
wrapt==1.11.2
58+
yapf==0.29.0

django/gsmap/admin.py

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
from django.contrib.gis import admin
2+
from django.contrib.postgres import fields
23
from django.utils.translation import gettext as _
3-
from gsmap.models import Municipality, Snapshot
4+
from django_json_widget.widgets import JSONEditorWidget
5+
from sortedm2m_filter_horizontal_widget.forms import SortedFilteredSelectMultiple
6+
from gsmap.models import Municipality, Snapshot, Workspace
47

58

69
class MunicipalityAdmin(admin.OSMGeoAdmin):
710
pass
811

912

1013
class SnapshotAdmin(admin.OSMGeoAdmin):
11-
readonly_fields = (
12-
'id', 'created',
13-
)
14+
readonly_fields = ('id', 'created', 'modified', 'get_absolute_link')
1415
fieldsets = (
1516
(_('Meta'), {
16-
'fields': ('created', 'id', 'is_showcase', 'archived', 'deleted')
17+
'fields': (
18+
'id', 'get_absolute_link', 'created', 'modified',
19+
'is_showcase', 'archived', 'deleted', 'permission'
20+
)
1721
}),
1822
(_('Main'), {
1923
'fields':
@@ -28,8 +32,41 @@ class SnapshotAdmin(admin.OSMGeoAdmin):
2832
# ('perimeter',),
2933
# }),
3034
)
31-
list_display = ('id', 'created')
35+
36+
formfield_overrides = {
37+
fields.JSONField: {
38+
'widget': JSONEditorWidget
39+
},
40+
}
41+
42+
list_display = ('id', 'title', 'municipality', 'permission', 'is_showcase',
43+
'created', 'modified')
44+
list_filter = ('is_showcase', 'permission')
45+
search_fields = ['title', 'municipality__name', 'municipality__canton']
46+
47+
48+
class WorkspaceAdmin(admin.OSMGeoAdmin):
49+
readonly_fields = ('id', 'created', 'modified', 'get_absolute_link')
50+
fieldsets = (
51+
(_('Meta'), {
52+
'fields': (
53+
'id', 'get_absolute_link',
54+
'created', 'modified'
55+
)
56+
}),
57+
(_('Main'), {
58+
'fields': ('title', 'description', 'snapshots'),
59+
}),
60+
)
61+
list_display = ('id', 'title', 'created', 'modified')
62+
search_fields = ['title']
63+
64+
def formfield_for_manytomany(self, db_field, request=None, **kwargs):
65+
if db_field.name == 'snapshots':
66+
kwargs['widget'] = SortedFilteredSelectMultiple()
67+
return super().formfield_for_manytomany(db_field, request, **kwargs)
3268

3369

3470
admin.site.register(Municipality, MunicipalityAdmin)
3571
admin.site.register(Snapshot, SnapshotAdmin)
72+
admin.site.register(Workspace, WorkspaceAdmin)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 3.0.3 on 2020-04-05 08:50
2+
3+
from django.db import migrations, models
4+
import gsmap.models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('gsmap', '0011_auto_20200306_1539'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='snapshot',
16+
name='modified',
17+
field=models.DateTimeField(auto_now=True),
18+
),
19+
migrations.AddField(
20+
model_name='snapshot',
21+
name='permission',
22+
field=models.IntegerField(choices=[(gsmap.models.SnapshotPermission['PUBLIC'], 0), (gsmap.models.SnapshotPermission['NOT_LISTED'], 10)], default=gsmap.models.SnapshotPermission['PUBLIC']),
23+
),
24+
]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Generated by Django 3.0.3 on 2020-04-05 15:55
2+
3+
from django.db import migrations, models
4+
import gsmap.models
5+
import sortedm2m.fields
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('gsmap', '0012_auto_20200405_0850'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='snapshot',
17+
name='permission',
18+
field=models.IntegerField(choices=[(0, 'PUBLIC'), (10, 'NOT_LISTED')], default=gsmap.models.SnapshotPermission['PUBLIC']),
19+
),
20+
migrations.CreateModel(
21+
name='Workspace',
22+
fields=[
23+
('id', models.CharField(default=gsmap.models.create_slug_hash, max_length=8, primary_key=True, serialize=False, unique=True)),
24+
('created', models.DateTimeField(auto_now_add=True)),
25+
('modified', models.DateTimeField(auto_now=True)),
26+
('title', models.CharField(default='', max_length=150)),
27+
('description', models.TextField(default='')),
28+
('snapshots', sortedm2m.fields.SortedManyToManyField(help_text=None, to='gsmap.Snapshot')),
29+
],
30+
options={
31+
'ordering': ['-created'],
32+
},
33+
),
34+
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Generated by Django 3.0.3 on 2020-04-05 16:22
2+
3+
from django.db import migrations
4+
import sortedm2m.fields
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('gsmap', '0013_auto_20200405_1555'),
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='SnapshotRaw',
16+
fields=[
17+
],
18+
options={
19+
'proxy': True,
20+
'indexes': [],
21+
'constraints': [],
22+
},
23+
bases=('gsmap.snapshot',),
24+
),
25+
migrations.AlterField(
26+
model_name='workspace',
27+
name='snapshots',
28+
field=sortedm2m.fields.SortedManyToManyField(help_text=None, to='gsmap.SnapshotRaw'),
29+
),
30+
]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 3.0.3 on 2020-04-06 18:03
2+
3+
from django.db import migrations
4+
import sortedm2m.fields
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('gsmap', '0014_auto_20200405_1622'),
11+
]
12+
13+
operations = [
14+
migrations.DeleteModel(
15+
name='SnapshotRaw',
16+
),
17+
migrations.AlterField(
18+
model_name='workspace',
19+
name='snapshots',
20+
field=sortedm2m.fields.SortedManyToManyField(help_text=None, to='gsmap.Snapshot'),
21+
),
22+
]

0 commit comments

Comments
 (0)