#146 Admins and update_all_parcels.py
* extends admin backend
* adds found_in_codelists to KonovaCodeAdmin to see where a KonovaCode can be found in
* improves rendering of after_states and before_states for all AbstractCompensationAdmins
* adds geometry_id to all major datatype admin backends
* adds st_area like calculation to geometry admin backend
* update_all_parcels
* orders geometries by size (small to big) to process smaller geometries first and bigger later
* adds more output to command for a better overview of what is just going on
This commit is contained in:
@@ -8,6 +8,7 @@ Created on: 22.07.21
|
||||
from django.contrib import admin
|
||||
|
||||
from konova.models import Geometry, Deadline, GeometryConflict, Parcel, District, Municipal, ParcelGroup
|
||||
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
|
||||
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE
|
||||
from user.models import UserAction
|
||||
|
||||
@@ -16,7 +17,22 @@ class GeometryAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"created",
|
||||
"st_area",
|
||||
]
|
||||
readonly_fields = [
|
||||
"st_area",
|
||||
"created",
|
||||
"modified",
|
||||
]
|
||||
|
||||
def st_area(self, obj):
|
||||
val = None
|
||||
geom = obj.geom
|
||||
if geom is not None:
|
||||
geom.transform(ct=DEFAULT_SRID_RLP)
|
||||
val = geom.area
|
||||
return val
|
||||
st_area.short_description = f"Area (srid={DEFAULT_SRID_RLP})"
|
||||
|
||||
|
||||
class ParcelAdmin(admin.ModelAdmin):
|
||||
|
||||
Reference in New Issue
Block a user