Skip to content

Commit

Permalink
Merge pull request #214 from gm3dmo/formscrazinessfix
Browse files Browse the repository at this point in the history
fixing image upload missing in mgmt form for soldiers
  • Loading branch information
gm3dmo authored Sep 1, 2024
2 parents cce7026 + 20a3f07 commit 63a949a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 6 additions & 4 deletions cmp/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ class Meta:
fields = "__all__"


class editSoldierDeathForm(forms.ModelForm):
class Meta:
model = SoldierDeath
fields = ["date", "cemetery", "image"]


class editSoldierForm(forms.ModelForm):
class Meta:
model = Soldier
fields = "__all__"


class editSoldierDeathForm(forms.ModelForm):
class Meta:
model = SoldierDeath
fields = ["date", "cemetery", "image"]

12 changes: 5 additions & 7 deletions templates/cmp/edit-soldiers.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@
<h1 class="mgmt-title">Update Soldier Record </h1>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form.management_form }}

{{ form.as_p }}
{{ death_form.as_p }}
{{ form.errors }}
{{ death_form.errors }}
{{form | crispy}}

{% if soldier.soldierdeath %}
<h2 class="mgmt-title">Soldier Death Details </h2>
{{ death_form|crispy }}
{% endif %}


<button type="submit" class="btn btn-primary">Save</button>
</form>
</div>


{% endblock %}

0 comments on commit 63a949a

Please sign in to comment.