-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add optional model for map layers #3
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to move MapLayerModel to mapengine models.py.
if settings.MAP_ENGINE_MAPLAYER_MODEL: | ||
# get MapLayerModel from settings | ||
try: | ||
MapLayerModel = apps.get_model(app_label='map', model_name=settings.MAP_ENGINE_MAPLAYER_MODEL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the MapLayerModel would be integrated in mapengine's models.py ?
This would make model available in all projects which use mapengine automatically.
Also this would remove need for app.get_model
and currently hardcoded "map" namespace.
|
||
# get choropleth fields | ||
try: | ||
model_field = MapLayerModel._meta.get_field("choropleth_field") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also be obsolete, as we make sure field exists by providing model from within mapengine
Hi @finnus , when you create the model please add a placeholder for unit in case some models dont have one |
56b7cdf
to
d6dd963
Compare
…ptional_map_layer_model # Conflicts: # django_mapengine/static/django_mapengine/js/legend.js
initStore has been overridden by digiplan
The idea behind the PR is to put more configuration of the map layers into django models.
That would have some advantages (more flexible, no need to change code when changing minor things or even adding/removing layers/choropleths/popups).
This is a first guess into that direction, with a few downsides:
As this approach looks still promising to me, I added the respective code. If no MapLayerModel is defined in the settings, it should work as before.