Fix DMS entity assignment and Geschichte document linking

- DMS edit view: add Destinatär, Land, Pächter, Verpachtung dropdowns
  so documents can be assigned to entities after upload
- Geschichte: add M2M dokumente field on GeschichteSeite model
- Geschichte form: checkboxes to select/link Stiftungsgeschichte docs
- Geschichte detail: show linked documents in sidebar with download

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
SysAdmin Agent
2026-03-12 10:40:46 +00:00
parent e6f4c5ba1b
commit 5c9db56158
7 changed files with 167 additions and 12 deletions

View File

@@ -41,6 +41,56 @@
<textarea name="beschreibung" class="form-control" rows="3">{{ dok.beschreibung }}</textarea>
</div>
<!-- Zuordnung -->
<hr>
<h6 class="fw-semibold mb-3"><i class="fas fa-link me-2"></i>Zuordnung</h6>
<div class="row g-3 mb-4">
<div class="col-md-6">
<label class="form-label small fw-semibold">Destinatär</label>
<select name="destinataer_id" class="form-select form-select-sm">
<option value=""> keine </option>
{% for d in destinataere %}
<option value="{{ d.pk }}" {% if dok.destinataer_id == d.pk %}selected{% endif %}>
{{ d.get_full_name }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-6">
<label class="form-label small fw-semibold">Länderei</label>
<select name="land_id" class="form-select form-select-sm">
<option value=""> keine </option>
{% for l in laendereien %}
<option value="{{ l.pk }}" {% if dok.land_id == l.pk %}selected{% endif %}>
{{ l.lfd_nr }}{% if l.gemeinde %} {{ l.gemeinde }}{% endif %}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-6">
<label class="form-label small fw-semibold">Pächter</label>
<select name="paechter_id" class="form-select form-select-sm">
<option value=""> keine </option>
{% for p in paechter_qs %}
<option value="{{ p.pk }}" {% if dok.paechter_id == p.pk %}selected{% endif %}>
{{ p.get_full_name }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-6">
<label class="form-label small fw-semibold">Verpachtung</label>
<select name="verpachtung_id" class="form-select form-select-sm">
<option value=""> keine </option>
{% for v in verpachtungen %}
<option value="{{ v.pk }}" {% if dok.verpachtung_id == v.pk %}selected{% endif %}>
{{ v.land.lfd_nr }} {{ v.paechter.get_full_name }} ({{ v.vertragsbeginn|date:"Y" }})
</option>
{% endfor %}
</select>
</div>
</div>
<div class="d-flex gap-2 justify-content-end">
<a href="{% url 'stiftung:dms_detail' pk=dok.pk %}" class="btn btn-outline-secondary">Abbrechen</a>
<button type="submit" class="btn btn-primary">