v4.1.0: DMS email documents, category-specific Nachweis linking, version system
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled

- 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:
SysAdmin Agent
2026-03-15 18:48:52 +00:00
parent faeb7c1073
commit e0b377014c
49 changed files with 5913 additions and 55 deletions

View File

@@ -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()
),
)