Skip to content

Commit

Permalink
Adding pow country picker which finally seems to be working.
Browse files Browse the repository at this point in the history
  • Loading branch information
gm3dmo committed Dec 17, 2023
1 parent 433385b commit d2ad127
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 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
8 changes: 7 additions & 1 deletion templates/cmp/soldier.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ <h1>Soldier Record</h1>
{% endfor %}
{% endif %}

<tr><td colspan="2"><h4>Prisoner of War Record:</h4></td></tr>
{% 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>
Expand Down

0 comments on commit d2ad127

Please sign in to comment.