4c9d041254
Drink gets a year field (default 2024 for legacy rows), with name+year unique together so each festival can have its own price/crate config without overwriting the previous year. User balance properties (consumed_drinks_price, paid_amount, open_balance) and the new current_year() helper all filter by current year so year-over-year data stays separated. UserPayment model tracks per-user payments (cash/PayPal/bank/other) against their drink tab, separate from Donation (event-level income). Verbose names + Meta verbose_name(_plural) added across all models, and LANGUAGE_CODE set to "de" so the admin renders German throughout. Drink gains a few derived properties (crates_full_returned, crates_remaining, bottles_consumed, bottles_remaining, remaining_purchase_value) used by the upcoming admin and dashboard views. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
# Generated by Django 6.0.5 on 2026-05-14 19:37
|
|
|
|
import django.db.models.deletion
|
|
import gaehsnitz.models
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("gaehsnitz", "0005_alter_consumption_options_alter_donation_options_and_more"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="UserPayment",
|
|
fields=[
|
|
("id", models.SmallAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("amount", gaehsnitz.models.PriceField(decimal_places=2, max_digits=6, verbose_name="Betrag")),
|
|
(
|
|
"method",
|
|
models.CharField(
|
|
choices=[
|
|
("cash", "Bar"),
|
|
("paypal", "PayPal"),
|
|
("bank", "Überweisung"),
|
|
("other", "Sonstiges"),
|
|
],
|
|
max_length=16,
|
|
verbose_name="Methode",
|
|
),
|
|
),
|
|
("note", models.CharField(blank=True, default="", max_length=64, verbose_name="Notiz")),
|
|
("created_at", models.DateTimeField(auto_now_add=True, verbose_name="Bezahlt am")),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="user_payments",
|
|
related_query_name="user_payment",
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="Benutzer",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Zahlung",
|
|
"verbose_name_plural": "Zahlungen",
|
|
},
|
|
),
|
|
]
|