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:
@@ -9,7 +9,7 @@ from intervention.models import Intervention
|
||||
from intervention.tables import InterventionTable
|
||||
from konova.contexts import BaseContext
|
||||
from konova.decorators import *
|
||||
from konova.forms import RemoveForm
|
||||
from konova.forms import RemoveForm, SimpleGeomForm
|
||||
|
||||
|
||||
@login_required
|
||||
@@ -75,7 +75,7 @@ def new_view(request: HttpRequest):
|
||||
|
||||
@login_required
|
||||
def open_view(request: HttpRequest, id: str):
|
||||
""" Renders a view for viewing an intervention's data
|
||||
""" Renders a detail view for viewing an intervention's data
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
@@ -84,12 +84,21 @@ def open_view(request: HttpRequest, id: str):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
template = "intervention/open.html"
|
||||
template = "intervention/detail-view.html"
|
||||
intervention = get_object_or_404(Intervention, id=id)
|
||||
form = OpenInterventionForm(instance=intervention)
|
||||
has_access = intervention.has_access(user=request.user)
|
||||
|
||||
if not has_access:
|
||||
messages.info(request, _("Remember: This data has not been shared with you, yet. This means you can only read but can not edit or perform any actions like running a check or recording."))
|
||||
|
||||
geom_form = SimpleGeomForm(
|
||||
instance=intervention
|
||||
)
|
||||
|
||||
context = {
|
||||
"intervention": intervention,
|
||||
"form": form,
|
||||
"has_access": has_access,
|
||||
"geom_form": geom_form,
|
||||
}
|
||||
context = BaseContext(request, context).context
|
||||
return render(request, template, context)
|
||||
|
||||
Reference in New Issue
Block a user