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:
mipel
2021-07-22 13:19:14 +02:00
parent 591bc739ec
commit 5e48bac013
13 changed files with 292 additions and 95 deletions

21
konova/admin.py Normal file
View File

@@ -0,0 +1,21 @@
"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 22.07.21
"""
from django.contrib import admin
from konova.models import Geometry
class GeometryAdmin(admin.ModelAdmin):
list_display = [
"id",
"created_on",
"created_by",
]
admin.site.register(Geometry, GeometryAdmin)

View File

@@ -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")

View File

@@ -42,7 +42,7 @@ USER_NOTIFICATIONS_NAMES = {
"NOTIFY_ON_NEW_RELATED_DATA": _("On new related data"),
"NOTIFY_ON_SHARE_LINK_DISABLED": _("On disabled share link"),
"NOTIFY_ON_SHARED_ACCESS_REMOVED": _("On shared access removed"),
"NOTIFY_ON_SHARED_DATA_REGISTERED": _("On shared data registered"),
"NOTIFY_ON_SHARED_DATA_RECORDED": _("On shared data recorded"),
"NOTIFY_ON_SHARED_DATA_DELETED": _("On shared data deleted"),
"NOTIFY_ON_REGISTERED_DATA_EDITED": _("On registered data edited"),
}

View File

@@ -11,6 +11,8 @@ from django.contrib.auth.models import User
from django.contrib.gis.db.models import MultiPolygonField
from django.db import models
from konova.settings import DEFAULT_SRID
class BaseResource(models.Model):
"""
@@ -67,4 +69,4 @@ class Geometry(BaseResource):
"""
Outsourced geometry model so multiple versions of the same object can refer to the same geometry if it is not changed
"""
geom = MultiPolygonField(null=True, blank=True)
geom = MultiPolygonField(null=True, blank=True, srid=DEFAULT_SRID)

View File

@@ -48,6 +48,7 @@ SSO_PUBLIC_KEY = "CHANGE_ME"
DEFAULT_LAT = 50.00
DEFAULT_LON = 7.00
DEFAULT_ZOOM = 8.0
DEFAULT_SRID = 4326
# GROUPS
DEFAULT_GROUP = "Default"