v4.1.0: DMS email documents, category-specific Nachweis linking, version system
- Save cover email body as DMS document with new 'email' context type - Show email body separately from attachments in email detail view - Add per-category DMS document assignment in quarterly confirmation (Studiennachweis, Einkommenssituation, Vermögenssituation) - Add VERSION file and context processor for automatic version display - Add MCP server, agent system, import/export, and new migrations - Update compose files and production environment template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,8 +14,8 @@ import qrcode.image.svg
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models import (Avg, Count, DecimalField, F, IntegerField, Q,
|
||||
Sum, Value)
|
||||
from django.db.models import (Avg, BigIntegerField, Count, DecimalField, F,
|
||||
IntegerField, Q, Sum, Value)
|
||||
from django.db.models.functions import Cast, Coalesce, NullIf, Replace
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
@@ -274,24 +274,25 @@ def land_list(request):
|
||||
lands = lands.filter(aktiv=False)
|
||||
|
||||
# Annotate with verpachtungsgrad and numeric casts for natural sorting
|
||||
# Prepare numeric versions of textual fields by stripping common non-digits
|
||||
# Use regexp_replace to strip ALL non-digit characters for safe integer casting
|
||||
from django.db.models import Func
|
||||
|
||||
class RegexpReplace(Func):
|
||||
function = "REGEXP_REPLACE"
|
||||
template = "%(function)s(%(expressions)s, '[^0-9]', '', 'g')"
|
||||
|
||||
def digits_only(field_expr):
|
||||
expr = Replace(field_expr, Value(" "), Value(""))
|
||||
expr = Replace(expr, Value("-"), Value(""))
|
||||
expr = Replace(expr, Value("."), Value(""))
|
||||
expr = Replace(expr, Value("/"), Value(""))
|
||||
expr = Replace(expr, Value("L"), Value(""))
|
||||
return expr
|
||||
return RegexpReplace(field_expr)
|
||||
|
||||
lands = lands.extra(
|
||||
select={
|
||||
"verpachtungsgrad": "CASE WHEN groesse_qm > 0 THEN (verp_flaeche_aktuell / groesse_qm) * 100 ELSE 0 END"
|
||||
}
|
||||
).annotate(
|
||||
lfd_nr_num=Cast(NullIf(digits_only(F("lfd_nr")), Value("")), IntegerField()),
|
||||
flur_num=Cast(NullIf(digits_only(F("flur")), Value("")), IntegerField()),
|
||||
lfd_nr_num=Cast(NullIf(digits_only(F("lfd_nr")), Value("")), BigIntegerField()),
|
||||
flur_num=Cast(NullIf(digits_only(F("flur")), Value("")), BigIntegerField()),
|
||||
flurstueck_num=Cast(
|
||||
NullIf(digits_only(F("flurstueck")), Value("")), IntegerField()
|
||||
NullIf(digits_only(F("flurstueck")), Value("")), BigIntegerField()
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user