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:
@@ -9,11 +9,173 @@
|
||||
<h1 class="h3">
|
||||
<i class="fas fa-gift text-primary me-2"></i>Förderungen
|
||||
</h1>
|
||||
<a href="{% url 'stiftung:foerderung_create' %}" class="btn btn-primary">
|
||||
<i class="fas fa-plus me-2"></i> Neue Förderung
|
||||
</a>
|
||||
<div>
|
||||
<button type="button" class="btn btn-success me-2" data-bs-toggle="modal" data-bs-target="#exportModal">
|
||||
<i class="fas fa-download me-2"></i> CSV/PDF Export
|
||||
</button>
|
||||
<a href="{% url 'stiftung:foerderung_create' %}" class="btn btn-primary">
|
||||
<i class="fas fa-plus me-2"></i> Neue Förderung
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Export Modal -->
|
||||
<div class="modal fade" id="exportModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Export Optionen</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form id="exportForm" method="post" action="{% url 'stiftung:foerderung_list' %}">
|
||||
{% csrf_token %}
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h6 class="fw-bold">Export Format</h6>
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="format" id="format_csv" value="csv" checked>
|
||||
<label class="form-check-label" for="format_csv">
|
||||
<i class="fas fa-file-csv me-2"></i>CSV (Excel-kompatibel)
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="format" id="format_pdf" value="pdf">
|
||||
<label class="form-check-label" for="format_pdf">
|
||||
<i class="fas fa-file-pdf me-2"></i>PDF (Tabelle)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h6 class="fw-bold">Export Umfang</h6>
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="scope" id="scope_all" value="all" checked>
|
||||
<label class="form-check-label" for="scope_all">
|
||||
Alle Einträge (<span id="total-count">{{ foerderungen.count }}</span>)
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="scope" id="scope_selected" value="selected">
|
||||
<label class="form-check-label" for="scope_selected">
|
||||
Nur ausgewählte Einträge (<span id="selected-count">0</span>)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6" id="field-selection" style="max-height: 400px; overflow-y: auto;">
|
||||
<h6 class="fw-bold">Felder auswählen</h6>
|
||||
<div class="mb-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-primary me-2" onclick="selectAllFields()">Alle auswählen</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="selectDefaultFields()">Standard</button>
|
||||
</div>
|
||||
|
||||
<div class="field-groups">
|
||||
<!-- Kernfelder -->
|
||||
<div class="mb-3">
|
||||
<h6 class="text-muted mb-2">Kernfelder</h6>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="destinataer_name" id="field_destinataer_name" checked>
|
||||
<label class="form-check-label" for="field_destinataer_name">Destinatär Name</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="jahr" id="field_jahr" checked>
|
||||
<label class="form-check-label" for="field_jahr">Jahr</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="betrag" id="field_betrag" checked>
|
||||
<label class="form-check-label" for="field_betrag">Betrag (€)</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="kategorie" id="field_kategorie" checked>
|
||||
<label class="form-check-label" for="field_kategorie">Kategorie</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="status" id="field_status" checked>
|
||||
<label class="form-check-label" for="field_status">Status</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="antragsdatum" id="field_antragsdatum" checked>
|
||||
<label class="form-check-label" for="field_antragsdatum">Antragsdatum</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Zeitfelder -->
|
||||
<div class="mb-3">
|
||||
<h6 class="text-muted mb-2">Datumsfelder</h6>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="bewilligungsdatum" id="field_bewilligungsdatum">
|
||||
<label class="form-check-label" for="field_bewilligungsdatum">Bewilligungsdatum</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="auszahlungsdatum" id="field_auszahlungsdatum">
|
||||
<label class="form-check-label" for="field_auszahlungsdatum">Auszahlungsdatum</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="erstellt_am" id="field_erstellt_am">
|
||||
<label class="form-check-label" for="field_erstellt_am">Erstellt am</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Beschreibungsfelder -->
|
||||
<div class="mb-3">
|
||||
<h6 class="text-muted mb-2">Details</h6>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="beschreibung" id="field_beschreibung" checked>
|
||||
<label class="form-check-label" for="field_beschreibung">Beschreibung</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="begruendung" id="field_begruendung">
|
||||
<label class="form-check-label" for="field_begruendung">Begründung</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="verwendungsnachweis_status" id="field_verwendungsnachweis_status">
|
||||
<label class="form-check-label" for="field_verwendungsnachweis_status">Verwendungsnachweis Status</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Destinataer Details -->
|
||||
<div class="mb-3">
|
||||
<h6 class="text-muted mb-2">Destinatär Details</h6>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="familienzweig" id="field_familienzweig">
|
||||
<label class="form-check-label" for="field_familienzweig">Familienzweig</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="email" id="field_email">
|
||||
<label class="form-check-label" for="field_email">E-Mail</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="telefon" id="field_telefon">
|
||||
<label class="form-check-label" for="field_telefon">Telefon</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="adresse" id="field_adresse">
|
||||
<label class="form-check-label" for="field_adresse">Adresse</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="fields" value="berufsgruppe" id="field_berufsgruppe">
|
||||
<label class="form-check-label" for="field_berufsgruppe">Berufsgruppe</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-download me-2"></i>Export starten
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Statistics Cards -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-3">
|
||||
@@ -107,6 +269,9 @@
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="50">
|
||||
<input type="checkbox" class="form-check-input" id="selectAll" onchange="toggleAllCheckboxes(this)">
|
||||
</th>
|
||||
<th>Person</th>
|
||||
<th>Jahr</th>
|
||||
<th>Betrag</th>
|
||||
@@ -120,9 +285,16 @@
|
||||
{% for foerderung in page_obj %}
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" class="form-check-input entry-checkbox" name="entry" value="{{ foerderung.pk }}" onchange="updateSelectedCount()">
|
||||
</td>
|
||||
<td>
|
||||
{% if foerderung.destinataer and foerderung.destinataer.pk %}
|
||||
<a href="{% url 'stiftung:destinataer_detail' foerderung.destinataer.pk %}">
|
||||
{{ foerderung.person.get_full_name }}
|
||||
{{ foerderung.destinataer.get_full_name }}
|
||||
</a>
|
||||
{% else %}
|
||||
<em class="text-muted">Keine Person zugeordnet</em>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ foerderung.jahr }}</td>
|
||||
<td>€{{ foerderung.betrag|floatformat:2 }}</td>
|
||||
@@ -200,4 +372,80 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let selectedEntries = [];
|
||||
|
||||
function toggleAllCheckboxes(source) {
|
||||
checkboxes = document.getElementsByName('entry');
|
||||
for(let i=0, n=checkboxes.length;i<n;i++) {
|
||||
checkboxes[i].checked = source.checked;
|
||||
}
|
||||
updateSelectedCount();
|
||||
}
|
||||
|
||||
function updateSelectedCount() {
|
||||
selectedEntries = [];
|
||||
const checkboxes = document.getElementsByName('entry');
|
||||
for(let i=0, n=checkboxes.length;i<n;i++) {
|
||||
if(checkboxes[i].checked) {
|
||||
selectedEntries.push(checkboxes[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
const count = selectedEntries.length;
|
||||
document.getElementById('selectedCount').textContent = count;
|
||||
document.getElementById('exportButton').disabled = count === 0;
|
||||
|
||||
// Update text in buttons
|
||||
document.getElementById('exportText').textContent =
|
||||
count === 0 ? 'Export' : `${count} Einträge exportieren`;
|
||||
}
|
||||
|
||||
function selectAllFields() {
|
||||
document.querySelectorAll('#exportModal input[type="checkbox"]').forEach(cb => cb.checked = true);
|
||||
}
|
||||
|
||||
function selectDefaultFields() {
|
||||
// First uncheck all
|
||||
document.querySelectorAll('#exportModal input[type="checkbox"]').forEach(cb => cb.checked = false);
|
||||
|
||||
// Then check default fields
|
||||
const defaultFields = [
|
||||
'destinataer__person__vorname',
|
||||
'destinataer__person__nachname',
|
||||
'jahr',
|
||||
'betrag',
|
||||
'kategorie',
|
||||
'status',
|
||||
'antragsdatum',
|
||||
'notizen'
|
||||
];
|
||||
|
||||
defaultFields.forEach(field => {
|
||||
const checkbox = document.querySelector(`#exportModal input[value="${field}"]`);
|
||||
if(checkbox) checkbox.checked = true;
|
||||
});
|
||||
}
|
||||
|
||||
function submitExportForm() {
|
||||
// Set selected entries
|
||||
document.getElementById('selectedEntries').value = selectedEntries.join(',');
|
||||
|
||||
// Collect selected fields
|
||||
const selectedFields = [];
|
||||
document.querySelectorAll('#exportModal input[type="checkbox"]:checked').forEach(cb => {
|
||||
selectedFields.push(cb.value);
|
||||
});
|
||||
document.getElementById('selectedFields').value = selectedFields.join(',');
|
||||
|
||||
// Submit form
|
||||
document.getElementById('exportForm').submit();
|
||||
}
|
||||
|
||||
// Initialize on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
updateSelectedCount();
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user