Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
b27598b6
Commit
b27598b6
authored
3 years ago
by
jan.bednarik
Browse files
Options
Downloads
Patches
Plain Diff
district: Small updates and fixes
parent
187c262e
No related branches found
No related tags found
2 merge requests
!487
Release
,
!481
Embedded map & map feature collection support
Pipeline
#7866
passed
3 years ago
Stage: build
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
district/models.py
+17
-16
17 additions, 16 deletions
district/models.py
maps_utils/const.py
+5
-4
5 additions, 4 deletions
maps_utils/const.py
with
22 additions
and
20 deletions
district/models.py
+
17
−
16
View file @
b27598b6
...
...
@@ -5,7 +5,6 @@ from django.core.cache import cache
from
django.core.exceptions
import
ValidationError
from
django.core.paginator
import
Paginator
from
django.db
import
models
from
django.db.models
import
signals
from
django.shortcuts
import
render
from
django.utils.translation
import
gettext_lazy
from
modelcluster.contrib.taggit
import
ClusterTaggableManager
...
...
@@ -1173,6 +1172,10 @@ class DistrictGeoFeatureCollectionPage(
),
]
settings_panels
=
[]
### RELATIONS
parent_page_types
=
[
"
district.DistrictHomePage
"
]
subpage_types
=
[
"
district.DistrictGeoFeatureDetailPage
"
]
...
...
@@ -1327,6 +1330,10 @@ class DistrictGeoFeatureDetailPage(
search_image
=
False
,
)
settings_panels
=
[]
### RELATIONS
parent_page_types
=
[
"
district.DistrictGeoFeatureCollectionPage
"
]
subpage_types
=
[]
...
...
@@ -1334,6 +1341,15 @@ class DistrictGeoFeatureDetailPage(
verbose_name
=
"
Položka mapové kolekce
"
ordering
=
[
"
sort_order
"
]
def
save
(
self
,
*
args
,
**
kwargs
):
# delete all sibling index cache keys to force recompute
keys
=
[
make_feature_index_cache_key
(
feature
)
for
feature
in
self
.
get_siblings
(
inclusive
=
True
)
]
cache
.
delete_many
(
keys
)
return
super
().
save
(
*
args
,
**
kwargs
)
@property
def
index
(
self
):
key
=
make_feature_index_cache_key
(
self
)
...
...
@@ -1390,18 +1406,3 @@ class DistrictGeoFeatureDetailPage(
)
except
ValueError
as
exc
:
raise
ValidationError
({
"
geojson
"
:
str
(
exc
)})
from
exc
def
invalidate_feature_index_cache
(
sender
,
**
kwargs
):
"""
When DistrictGeoFeatureDetailPage changes, delete all sibling index cache keys to force recompute.
"""
if
kwargs
.
get
(
"
instance
"
):
keys
=
[
make_feature_index_cache_key
(
feature
)
for
feature
in
kwargs
[
"
instance
"
].
get_siblings
(
inclusive
=
True
)
]
cache
.
delete_many
(
keys
)
signals
.
post_save
.
connect
(
invalidate_feature_index_cache
,
sender
=
DistrictGeoFeatureDetailPage
)
This diff is collapsed.
Click to expand it.
maps_utils/const.py
+
5
−
4
View file @
b27598b6
MAP_STYLES
=
(
(
"
osm-mapnik
"
,
"
OSM Mapnik
"
),
(
"
stamen-toner
"
,
"
Stamen Toner
"
),
(
"
stamen-terrain
"
,
"
Stamen Terrain
"
),
(
"
stadia-osm-bright
"
,
"
Stadia OSM Bright (vyžaduje API klíč)
"
),
(
"
stadia-outdoors
"
,
"
Stadia Outdoors (vyžaduje API klíč)
"
),
# TODO allow when we have working proxy
# ("stamen-toner", "Stamen Toner"),
# ("stamen-terrain", "Stamen Terrain"),
# ("stadia-osm-bright", "Stadia OSM Bright (vyžaduje API klíč)"),
# ("stadia-outdoors", "Stadia Outdoors (vyžaduje API klíč)"),
)
DEFAULT_MAP_STYLE
=
"
osm-mapnik
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment