Intervention Detail View
* adds (WIP) detail view for interventions * renames typo in conservations_file_number to conservation_file_number * adds simple has_access check for intervention objects for given users * renames occurences of "Registered" to "Recorded" (verzeichnen) * adds an informing message for detail view of intervention objects which are not editable for a user * adds GeometryAdmin * adds fallback DEFAULT_SRID for Geometry model * adds translations
This commit is contained in:
@@ -10,6 +10,7 @@ from abc import abstractmethod
|
||||
|
||||
from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.gis.forms import GeometryField, OSMWidget, MultiPolygonField
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
@@ -94,3 +95,30 @@ class RemoveForm(BaseForm):
|
||||
self.object_to_remove.save()
|
||||
return self.object_to_remove
|
||||
|
||||
|
||||
class SimpleGeomForm(BaseForm):
|
||||
""" A geometry form for rendering geometry read-only using a widget
|
||||
|
||||
"""
|
||||
geom = GeometryField(
|
||||
widget=OSMWidget(
|
||||
attrs={
|
||||
"map_width": 600,
|
||||
"map_height": 400,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
Constructor does not need to perform further initial setup, like other forms.
|
||||
We simply use this here for easy rendering of a geometry view component
|
||||
|
||||
Args:
|
||||
*args ():
|
||||
**kwargs ():
|
||||
"""
|
||||
super().__init__(*args, **kwargs)
|
||||
geom = self.instance.geometry.geom
|
||||
self.initialize_form_field("geom", geom)
|
||||
self.disable_form_field("geom")
|
||||
|
||||
Reference in New Issue
Block a user