Skip to content

Commit

Permalink
Merge pull request #128 from gm3dmo/dec17
Browse files Browse the repository at this point in the history
Adding decorations picker which seems to work.
  • Loading branch information
gm3dmo authored Dec 17, 2023
2 parents 5b8d869 + d2ad127 commit d90b511
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
6 changes: 5 additions & 1 deletion cmp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class SoldierDeath(models.Model):
company = models.ForeignKey(Company, blank=True, null=True, default="UNKNOWN", on_delete=models.CASCADE, related_name='companies')
cemetery = models.ForeignKey(Cemetery, blank=True, null=True, default=110, on_delete=models.CASCADE, related_name='cemeteries')
cwgc_id = models.IntegerField(blank=True, null=True, unique=False, verbose_name="War Graves ID")
def __unicode__(self):

def __str__(self):
return '%s %s %s' % (self.Soldier, self.date, self.cemetery)

def cwgc_url(self):
Expand Down Expand Up @@ -152,6 +153,8 @@ class SoldierImprisonment(models.Model):
legacy_date_from = models.CharField(max_length=255, unique=False, default='')
legacy_date_to = models.CharField(max_length=255, unique=False, default='')
notes = models.CharField(max_length=255, unique=False, default='')
def __str__(self):
return self.pow_camp.name


class SoldierDecoration(models.Model):
Expand All @@ -165,6 +168,7 @@ class SoldierDecoration(models.Model):
country = models.ForeignKey(Country, blank=True, null=True, on_delete=models.CASCADE)
citation = models.TextField(max_length=50000, blank=True)
notes = models.TextField(max_length=50000, blank=True)

def __str__(self):
return self.decoration.name

Expand Down
35 changes: 26 additions & 9 deletions templates/cmp/soldier.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,32 @@ <h1>Soldier Record</h1>
<tr><td>Army Number:</td><td>{{ soldier.army_number }}</td></tr>
<tr><td>Notes:</td><td>{{ soldier.notes }}</td></tr>

<tr><td colspan="2"><h4>Decorations Record:</h4></td></tr>
<tr><td colspan="2"><h4>Prisoner of War Record:</h4></td></tr>

<tr><td colspan="2"><h4>Casualty Record:</h4></td></tr>
<tr><td>Date of Death:</td><td>{{ soldier.soldierdeath.date }}</td></tr>
<tr><td>Company:</td><td>{{ soldier.soldierdeath.company }}</td></tr>
<tr><td>Cemetery:</td><td>{{ soldier.soldierdeath.cemetery }}</td></tr>
<tr><td colspan="2">Map</td></tr>
<tr><td colspan="2">A map goes here</tr>
{% if soldier.soldierdecoration_set.all %}
<tr><td colspan="2"><h4>Decorations Record:</h4></td></tr>
{% for decoration in soldier.soldierdecoration_set.all %}
<tr><td>decoration: </td><td>{{ decoration }}</td></tr>
{% endfor %}
{% endif %}

{% if soldier.soldierimprisonment_set.exists %}
<tr><td colspan="2"><h4>Prisoner of War Record:</h4></td></tr>
{% for imprisonment in soldier.soldierimprisonment_set.all %}
<tr><td>Imprisonment: </td><td>{{ imprisonment }} {{imprisonment.pow_camp.country}} {{imprisonment.pow_camp.country.flag}}</td></tr>
{% endfor %}

{% endif %}


{% if soldier.soldierdeath %}
<tr><td colspan="2"><h4>Casualty Record:</h4></td></tr>
<tr><td>Date of Death:</td><td>{{ soldier.soldierdeath.date }}</td></tr>
<tr><td>Company:</td><td>{{ soldier.soldierdeath.company }}</td></tr>
<tr><td>Cemetery:</td><td>{{ soldier.soldierdeath.cemetery }}</td></tr>
<tr><td colspan="2">Map</td></tr>
<tr><td colspan="2">A map goes here</tr>
{% endif %}




</tbody>
Expand Down

0 comments on commit d90b511

Please sign in to comment.