fix: configure CI database connection properly

- Add dotenv loading to Django settings
- Update CI workflow to use correct environment variables
- Set POSTGRES_* variables instead of DATABASE_URL
- Add environment variables to all Django management commands
- Fixes CI test failures due to database connection issues
This commit is contained in:
Stiftung Development
2025-09-06 18:47:23 +02:00
parent dcc91b9f49
commit 35ba089a84
64 changed files with 7040 additions and 1419 deletions

View File

@@ -391,6 +391,7 @@
<th>Fläche</th>
<th>Pachtzins</th>
<th>Status</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
@@ -433,6 +434,21 @@
<span class="badge bg-info">{{ verpachtung.get_status_display }}</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'stiftung:land_verpachtung_detail' verpachtung.pk %}" class="btn btn-outline-primary" title="Details anzeigen">
<i class="fas fa-eye"></i>
</a>
<a href="{% url 'stiftung:land_verpachtung_update' verpachtung.pk %}" class="btn btn-outline-warning" title="Bearbeiten">
<i class="fas fa-edit"></i>
</a>
{% if verpachtung.status == 'aktiv' %}
<a href="{% url 'stiftung:land_verpachtung_end_direct' verpachtung.pk %}" class="btn btn-outline-danger" title="Beenden">
<i class="fas fa-stop"></i>
</a>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
@@ -626,11 +642,18 @@
<i class="fas fa-handshake me-2"></i>Verpachtungs-Management
</h6>
<div class="btn-group">
{% if not land.aktueller_paechter %}
{% if land.neue_verpachtungen.exists %}
<!-- New system: Create new LandVerpachtung -->
<a href="{% url 'stiftung:land_verpachtung_create' land_pk=land.pk %}" class="btn btn-sm btn-success">
<i class="fas fa-plus me-2"></i>Neue Verpachtung
</a>
{% elif not land.aktueller_paechter %}
<!-- Old system: No current tenant -->
<a href="{% url 'stiftung:land_verpachtung_create' land_pk=land.pk %}" class="btn btn-sm btn-success">
<i class="fas fa-plus me-2"></i>Verpachtung erstellen
</a>
{% else %}
<!-- Old system: Has current tenant -->
<a href="{% url 'stiftung:land_verpachtung_edit' land_pk=land.pk %}" class="btn btn-sm btn-warning">
<i class="fas fa-edit me-2"></i>Verpachtung bearbeiten
</a>
@@ -641,7 +664,7 @@
</div>
</div>
<div class="card-body">
<!-- Neue Verpachtungen anzeigen -->
<!-- New LandVerpachtung objects -->
{% if land.neue_verpachtungen.all %}
<div class="table-responsive">
<table class="table table-hover">
@@ -696,13 +719,18 @@
{% endif %}
</td>
<td>
<div class="btn-group" role="group">
<a href="#" class="btn btn-sm btn-outline-primary" title="Bearbeiten">
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'stiftung:land_verpachtung_detail' verpachtung.pk %}" class="btn btn-outline-primary" title="Details anzeigen">
<i class="fas fa-eye"></i>
</a>
<a href="{% url 'stiftung:land_verpachtung_update' verpachtung.pk %}" class="btn btn-outline-warning" title="Bearbeiten">
<i class="fas fa-edit"></i>
</a>
<a href="#" class="btn btn-sm btn-outline-danger" title="Beenden">
{% if verpachtung.status == 'aktiv' %}
<a href="{% url 'stiftung:land_verpachtung_end_direct' verpachtung.pk %}" class="btn btn-outline-danger" title="Beenden">
<i class="fas fa-stop"></i>
</a>
{% endif %}
</div>
</td>
</tr>
@@ -734,6 +762,58 @@
</div>
</div>
</div>
{% elif land.aktueller_paechter %}
<!-- Old system verpachtung display -->
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i>
<strong>Legacy Verpachtung:</strong> Diese Länderei verwendet das alte Verpachtungssystem.
</div>
<div class="table-responsive">
<table class="table table-hover">
<thead class="table-light">
<tr>
<th>Pächter</th>
<th>Zeitraum</th>
<th>Fläche</th>
<th>Pachtzins</th>
<th>Status</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="{% url 'stiftung:paechter_detail' land.aktueller_paechter.pk %}">
{{ land.aktueller_paechter.get_full_name }}
</a>
</td>
<td>
{% if land.pachtbeginn %}{{ land.pachtbeginn|date:"d.m.Y" }}{% else %}<span class="text-muted">N/A</span>{% endif %} -
{% if land.pachtende %}{{ land.pachtende|date:"d.m.Y" }}{% else %}<span class="text-muted">Unbefristet</span>{% endif %}
</td>
<td>
{{ land.verp_flaeche_aktuell|default_if_none:land.groesse_qm|floatformat:0 }} qm
</td>
<td>
{% if land.pachtzins_aktuell %}€{{ land.pachtzins_aktuell|floatformat:2 }}/Jahr{% else %}<span class="text-muted">N/A</span>{% endif %}
</td>
<td>
<span class="badge bg-warning">Legacy System</span>
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'stiftung:land_verpachtung_edit' land_pk=land.pk %}" class="btn btn-outline-warning" title="Bearbeiten">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'stiftung:land_verpachtung_end' land_pk=land.pk %}" class="btn btn-outline-danger" title="Beenden">
<i class="fas fa-stop"></i>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-5">
<i class="fas fa-handshake fa-3x text-muted mb-3"></i>
@@ -759,7 +839,7 @@
</div>
<div class="card-body">
<div class="d-grid gap-2">
<a href="{% url 'stiftung:verpachtung_create' %}?land={{ land.pk }}" class="btn btn-info">
<a href="{% url 'stiftung:land_verpachtung_create' land_pk=land.pk %}" class="btn btn-info">
<i class="fas fa-handshake me-2"></i>Neue Verpachtung
</a>
<a href="{% url 'stiftung:land_update' land.pk %}" class="btn btn-warning">