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
|
"discord_uuid": self.discord_uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def link(self):
|
||||||
|
"""
|
||||||
|
href to the player page
|
||||||
|
"""
|
||||||
|
return reverse("GeoffreyPlayerInfo", kwargs={"id": self.id})
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
Owner:
|
Owner:
|
||||||
{% endif %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
<p>Location: {{ loc.position }}</p>
|
<p>Location: {{ loc.position }}</p>
|
||||||
|
|
||||||
{% if loc.tunnel %}
|
{% if loc.tunnel %}
|
||||||
<p>Tunnel: {{ loc.tunnel.get_tunnel_direction_display }} {{ loc.tunnel.tunnel_number }}</p>
|
<p>Tunnel: {{ loc.tunnel.tunnel_str }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<hr class="my-4">
|
<hr class="my-4">
|
||||||
{% block info %}{% endblock %}
|
{% block info %}{% endblock %}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
<thead class="bg-dark">
|
<thead class="bg-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Location Name</th>
|
<th>Location Name</th>
|
||||||
<th>Coordinates</th>
|
<th>Position</th>
|
||||||
|
<th>Tunnel</th>
|
||||||
{% if show_owner %}
|
{% if show_owner %}
|
||||||
<th>Owner</th>
|
<th>Owner</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -12,12 +13,13 @@
|
||||||
{% for loc in loc_list %}
|
{% for loc in loc_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ loc.link }}">{{ loc.name }}</a></td>
|
<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 %}
|
{% if show_owner %}
|
||||||
<td>
|
<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" %},
|
{% for owner in loc.owner.all|slice:"1:3" %},
|
||||||
{% include "GeoffreyApp/player_link.html" with player=owner %}
|
<a href="{{ owner.link }}">{{ owner }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<a href="{% url 'GeoffreyPlayerInfo' player.id %}">{{ player.name }}</a>
|
|
|
@ -8,7 +8,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for player in player_list %}
|
{% for player in player_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{% include "GeoffreyApp/player_link.html" %}</td>
|
<td><a class="" href="{{ player.link }}">{{ player }}</a></td>
|
||||||
<td>{{ player.loc_count }} </td>
|
<td>{{ player.loc_count }} </td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "GeoffreyApp/base.html" %}
|
{% extends "GeoffreyApp/base.html" %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
Bases
|
Points of Interest
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
2
views.py
2
views.py
|
@ -95,7 +95,7 @@ class ModelInfoView(View):
|
||||||
|
|
||||||
def get(self, request, id):
|
def get(self, request, id):
|
||||||
try:
|
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:
|
except Player.DoesNotExist:
|
||||||
return render(request, 'GeoffreyApp/error.html')
|
return render(request, 'GeoffreyApp/error.html')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue