Small fixed and improvements
+ removed player_link template + gave the player model a link property + fixed some web-page display issuesdoc_update
parent
a47ea55fd6
commit
d149e39b84
|
@ -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
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
Owner:
|
||||
{% endif %}
|
||||
|
||||
{{ loc.owner.all.first }}{% for owner in loc.owner.all|slice:"1:" %}, {{ owner }}
|
||||
<a class="text-light" href="{{ loc.owner.all.first.link }}">{{ loc.owner.all.first }}</a>
|
||||
{% for owner in loc.owner.all|slice:"1:" %}, <a href="{{ owner.link }}">{{ owner.name }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
|
@ -20,7 +21,7 @@
|
|||
<p>Location: {{ loc.position }}</p>
|
||||
|
||||
{% if loc.tunnel %}
|
||||
<p>Tunnel: {{ loc.tunnel.get_tunnel_direction_display }} {{ loc.tunnel.tunnel_number }}</p>
|
||||
<p>Tunnel: {{ loc.tunnel.tunnel_str }}</p>
|
||||
{% endif %}
|
||||
<hr class="my-4">
|
||||
{% block info %}{% endblock %}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<thead class="bg-dark">
|
||||
<tr>
|
||||
<th>Location Name</th>
|
||||
<th>Coordinates</th>
|
||||
<th>Position</th>
|
||||
<th>Tunnel</th>
|
||||
{% if show_owner %}
|
||||
<th>Owner</th>
|
||||
{% endif %}
|
||||
|
@ -12,12 +13,13 @@
|
|||
{% for loc in loc_list %}
|
||||
<tr>
|
||||
<td><a href="{{ loc.link }}">{{ loc.name }}</a></td>
|
||||
<td>{{ loc.location }}</td>
|
||||
<td>{{ loc.position }}</td>
|
||||
<td>{% if loc.tunnel %} {{ loc.tunnel.tunnel_str }}{% else %}n/a{% endif %}</td>
|
||||
{% if show_owner %}
|
||||
<td>
|
||||
{% include "GeoffreyApp/player_link.html" with player=loc.owner.first %}
|
||||
<a href="{{ loc.owner.first.link }}">{{ loc.owner.first }}</a>
|
||||
{% for owner in loc.owner.all|slice:"1:3" %},
|
||||
{% include "GeoffreyApp/player_link.html" with player=owner %}
|
||||
<a href="{{ owner.link }}">{{ owner }}</a>
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% endif %}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<a href="{% url 'GeoffreyPlayerInfo' player.id %}">{{ player.name }}</a>
|
|
@ -8,7 +8,7 @@
|
|||
<tbody>
|
||||
{% for player in player_list %}
|
||||
<tr>
|
||||
<td>{% include "GeoffreyApp/player_link.html" %}</td>
|
||||
<td><a class="" href="{{ player.link }}">{{ player }}</a></td>
|
||||
<td>{{ player.loc_count }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "GeoffreyApp/base.html" %}
|
||||
|
||||
{% block header %}
|
||||
Bases
|
||||
Points of Interest
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
2
views.py
2
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')
|
||||
|
||||
|
|
Loading…
Reference in New Issue