M1: Grundgerüst, Datenmodell und Admin
Django-5.2-Projekt mit uv, django-environ und Docker-Compose-Setup (web + Postgres, WeasyPrint-Systembibliotheken im Image). Vollständiges Datenmodell (Firma, Therapeut, Auftraggeber, Teilnehmer, Leistungsart, Leistung, InvoiceLog, InvoiceCounter) mit Admin, Login-Flow und Platzhalter-Dashboard. Fortschritt in FORTSCHRITT.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016yy3uodsai6Ytt3GJ7tBdz
This commit is contained in:
80
abrechnung/admin.py
Normal file
80
abrechnung/admin.py
Normal file
@@ -0,0 +1,80 @@
|
||||
"""Admin-Registrierung. Stammdatenpflege läuft im MVP über den Django-Admin."""
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import (
|
||||
Auftraggeber,
|
||||
Firma,
|
||||
InvoiceCounter,
|
||||
InvoiceLog,
|
||||
Leistung,
|
||||
Leistungsart,
|
||||
Teilnehmer,
|
||||
Therapeut,
|
||||
)
|
||||
|
||||
|
||||
@admin.register(Firma)
|
||||
class FirmaAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "ort", "ust_idnr")
|
||||
|
||||
def has_add_permission(self, request):
|
||||
# Singleton: nur eine Firma zulassen.
|
||||
return not Firma.objects.exists()
|
||||
|
||||
|
||||
@admin.register(Therapeut)
|
||||
class TherapeutAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "kuerzel", "aktiv")
|
||||
list_filter = ("aktiv",)
|
||||
search_fields = ("name", "kuerzel")
|
||||
|
||||
|
||||
@admin.register(Auftraggeber)
|
||||
class AuftraggeberAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "typ", "ort", "ust_idnr")
|
||||
list_filter = ("typ",)
|
||||
search_fields = ("name",)
|
||||
|
||||
|
||||
@admin.register(Teilnehmer)
|
||||
class TeilnehmerAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "auftraggeber", "therapeut", "aktiv")
|
||||
list_filter = ("aktiv", "therapeut", "auftraggeber")
|
||||
search_fields = ("name", "aktenzeichen")
|
||||
autocomplete_fields = ("auftraggeber", "therapeut")
|
||||
|
||||
|
||||
@admin.register(Leistungsart)
|
||||
class LeistungsartAdmin(admin.ModelAdmin):
|
||||
list_display = ("bezeichnung", "standard_stundensatz", "aktiv")
|
||||
list_filter = ("aktiv",)
|
||||
search_fields = ("bezeichnung",)
|
||||
|
||||
|
||||
@admin.register(Leistung)
|
||||
class LeistungAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"datum", "teilnehmer", "therapeut", "leistungsart",
|
||||
"stundenanzahl", "stundensatz", "abgerechnet_mit",
|
||||
)
|
||||
list_filter = ("therapeut", "leistungsart", "datum")
|
||||
search_fields = ("teilnehmer__name", "beschreibung")
|
||||
autocomplete_fields = ("teilnehmer", "therapeut", "leistungsart")
|
||||
date_hierarchy = "datum"
|
||||
|
||||
|
||||
@admin.register(InvoiceLog)
|
||||
class InvoiceLogAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"rechnungsnummer", "datum", "auftraggeber", "gesamtbetrag",
|
||||
"typ", "status", "storno_von",
|
||||
)
|
||||
list_filter = ("status", "typ", "datum")
|
||||
search_fields = ("rechnungsnummer", "auftraggeber__name")
|
||||
readonly_fields = ("created_at", "created_by")
|
||||
|
||||
|
||||
@admin.register(InvoiceCounter)
|
||||
class InvoiceCounterAdmin(admin.ModelAdmin):
|
||||
list_display = ("praefix", "letzter_wert")
|
||||
Reference in New Issue
Block a user