#138 Map client to views
* adds netgis map client to all detail and report views * adds netgis map client to new object forms * WIP: needs functionality server-client
This commit is contained in:
@@ -238,6 +238,7 @@ class SimpleGeomForm(BaseForm):
|
||||
""" A geometry form for rendering geometry read-only using a widget
|
||||
|
||||
"""
|
||||
read_only = True
|
||||
geom = MultiPolygonField(
|
||||
srid=DEFAULT_SRID,
|
||||
label=_("Geometry"),
|
||||
@@ -245,19 +246,10 @@ class SimpleGeomForm(BaseForm):
|
||||
label_suffix="",
|
||||
required=False,
|
||||
disabled=False,
|
||||
widget=OSMWidget(
|
||||
attrs={
|
||||
"map_width": 600,
|
||||
"map_height": 400,
|
||||
# default_zoom defines the nearest possible zoom level from which the JS automatically
|
||||
# zooms out if geometry requires a larger view port. So define a larger range for smaller geometries
|
||||
"default_zoom": 25,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
read_only = kwargs.pop("read_only", True)
|
||||
self.read_only = kwargs.pop("read_only", True)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Initialize geometry
|
||||
@@ -271,8 +263,6 @@ class SimpleGeomForm(BaseForm):
|
||||
self.fields["geom"].widget.attrs["default_zoom"] = 1
|
||||
|
||||
self.initialize_form_field("geom", geom)
|
||||
if read_only:
|
||||
self.fields["geom"].disabled = True
|
||||
|
||||
def save(self, action: UserActionLogEntry):
|
||||
""" Saves the form's geometry
|
||||
|
||||
@@ -184,6 +184,8 @@ STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, 'konova/static'),
|
||||
os.path.join(BASE_DIR, 'templates/map/client'), # NETGIS map client files
|
||||
os.path.join(BASE_DIR, 'templates/map/client/libs'), # NETGIS map client files
|
||||
]
|
||||
|
||||
# DJANGO DEBUG TOOLBAR
|
||||
|
||||
Reference in New Issue
Block a user