diff --git a/models.py b/models.py index ddb07e2..6a3b193 100644 --- a/models.py +++ b/models.py @@ -78,6 +78,13 @@ class Player(models.Model): "discord_uuid": self.discord_uuid } + @property + def link(self): + """ + href to the player page + """ + return reverse("GeoffreyPlayerInfo", kwargs={"id": self.id}) + def __str__(self): return self.name diff --git a/templates/GeoffreyApp/location.html b/templates/GeoffreyApp/location.html index c3c6e2f..e225a8c 100644 --- a/templates/GeoffreyApp/location.html +++ b/templates/GeoffreyApp/location.html @@ -12,7 +12,8 @@ Owner: {% endif %} - {{ loc.owner.all.first }}{% for owner in loc.owner.all|slice:"1:" %}, {{ owner }} + {{ loc.owner.all.first }} + {% for owner in loc.owner.all|slice:"1:" %}, {{ owner.name }} {% endfor %}

@@ -20,7 +21,7 @@

Location: {{ loc.position }}

{% if loc.tunnel %} -

Tunnel: {{ loc.tunnel.get_tunnel_direction_display }} {{ loc.tunnel.tunnel_number }}

+

Tunnel: {{ loc.tunnel.tunnel_str }}

{% endif %}
{% block info %}{% endblock %} diff --git a/templates/GeoffreyApp/location_table.html b/templates/GeoffreyApp/location_table.html index 9cfde5d..2db26f2 100644 --- a/templates/GeoffreyApp/location_table.html +++ b/templates/GeoffreyApp/location_table.html @@ -2,7 +2,8 @@ Location Name - Coordinates + Position + Tunnel {% if show_owner %} Owner {% endif %} @@ -12,12 +13,13 @@ {% for loc in loc_list %} {{ loc.name }} - {{ loc.location }} + {{ loc.position }} + {% if loc.tunnel %} {{ loc.tunnel.tunnel_str }}{% else %}n/a{% endif %} {% if show_owner %} - {% include "GeoffreyApp/player_link.html" with player=loc.owner.first %} + {{ loc.owner.first }} {% for owner in loc.owner.all|slice:"1:3" %}, - {% include "GeoffreyApp/player_link.html" with player=owner %} + {{ owner }} {% endfor %} {% endif %} diff --git a/templates/GeoffreyApp/player_link.html b/templates/GeoffreyApp/player_link.html deleted file mode 100644 index 461f1ad..0000000 --- a/templates/GeoffreyApp/player_link.html +++ /dev/null @@ -1 +0,0 @@ -{{ player.name }} diff --git a/templates/GeoffreyApp/player_table.html b/templates/GeoffreyApp/player_table.html index 8853d8b..af562a6 100644 --- a/templates/GeoffreyApp/player_table.html +++ b/templates/GeoffreyApp/player_table.html @@ -8,7 +8,7 @@ {% for player in player_list %} - {% include "GeoffreyApp/player_link.html" %} + {{ player }} {{ player.loc_count }} {% endfor %} diff --git a/templates/GeoffreyApp/pointofinterest_list.html b/templates/GeoffreyApp/pointofinterest_list.html index 0e23887..15371d0 100644 --- a/templates/GeoffreyApp/pointofinterest_list.html +++ b/templates/GeoffreyApp/pointofinterest_list.html @@ -1,7 +1,7 @@ {% extends "GeoffreyApp/base.html" %} {% block header %} - Bases + Points of Interest {% endblock %} {% block content %} diff --git a/views.py b/views.py index 203ebbe..1d99986 100644 --- a/views.py +++ b/views.py @@ -95,7 +95,7 @@ class ModelInfoView(View): def get(self, request, id): try: - return render(request, 'GeoffreyApp/%s' % self.template, context=self.context(id)) + return render(request, 'GeoffreyApp/%s' % self.template, context=self.get_context(id)) except Player.DoesNotExist: return render(request, 'GeoffreyApp/error.html')