mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Show current training skills on the charlist
This commit is contained in:
@@ -4,6 +4,25 @@ from eve_api.app_defines import *
|
|||||||
from eve_api.models import EVEAPIModel
|
from eve_api.models import EVEAPIModel
|
||||||
|
|
||||||
|
|
||||||
|
class EVEPlayerCharacterSkill(models.Model):
|
||||||
|
"""
|
||||||
|
For our m2m join to EVESkills
|
||||||
|
"""
|
||||||
|
character = models.ForeignKey('eve_api.EVEPlayerCharacter')
|
||||||
|
skill = models.ForeignKey('eve_api.EVESkill')
|
||||||
|
level = models.IntegerField(default=0)
|
||||||
|
skillpoints = models.IntegerField(default=0)
|
||||||
|
in_training = models.IntegerField(default=0)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return u"%s - Level %s" % (self.skill, self.level)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'eve_api'
|
||||||
|
verbose_name = 'Player Character Skill'
|
||||||
|
verbose_name_plural = 'Player Character Skills'
|
||||||
|
|
||||||
|
|
||||||
class EVEPlayerCharacter(EVEAPIModel):
|
class EVEPlayerCharacter(EVEAPIModel):
|
||||||
"""
|
"""
|
||||||
Represents an individual player character within the game. Not to be
|
Represents an individual player character within the game. Not to be
|
||||||
@@ -34,12 +53,21 @@ class EVEPlayerCharacter(EVEAPIModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def director(self):
|
def director(self):
|
||||||
|
""" Returns a bool to indicate if the character is a director """
|
||||||
try:
|
try:
|
||||||
self.roles.get(name="roleDirector")
|
self.roles.get(name="roleDirector")
|
||||||
return True
|
return True
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_training(self):
|
||||||
|
""" Returns the current skill in training """
|
||||||
|
try:
|
||||||
|
return self.eveplayercharacterskill_set.get(in_training__gt=0)
|
||||||
|
except EVEPlayerCharacterSkill.DoesNotExist:
|
||||||
|
return None
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
if self.name:
|
if self.name:
|
||||||
return self.name
|
return self.name
|
||||||
@@ -50,23 +78,3 @@ class EVEPlayerCharacter(EVEAPIModel):
|
|||||||
app_label = 'eve_api'
|
app_label = 'eve_api'
|
||||||
verbose_name = 'Player Character'
|
verbose_name = 'Player Character'
|
||||||
verbose_name_plural = 'Player Characters'
|
verbose_name_plural = 'Player Characters'
|
||||||
|
|
||||||
|
|
||||||
class EVEPlayerCharacterSkill(models.Model):
|
|
||||||
"""
|
|
||||||
For our m2m join to EVESkills
|
|
||||||
"""
|
|
||||||
character = models.ForeignKey('eve_api.EVEPlayerCharacter')
|
|
||||||
skill = models.ForeignKey('eve_api.EVESkill')
|
|
||||||
level = models.IntegerField(default=0)
|
|
||||||
skillpoints = models.IntegerField(default=0)
|
|
||||||
in_training = models.IntegerField(default=0)
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return u"%s - Level %s" % (self.skill, self.level)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
app_label = 'eve_api'
|
|
||||||
verbose_name = 'Player Character Skill'
|
|
||||||
verbose_name_plural = 'Player Character Skills'
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
<li><span class="stat">Alliance:</span> <span class="value"><a href="http://evemaps.dotlan.net/alliance/{{ character.corporation.alliance.name }}">{{ character.corporation.alliance.name }}</a></span></li>
|
<li><span class="stat">Alliance:</span> <span class="value"><a href="http://evemaps.dotlan.net/alliance/{{ character.corporation.alliance.name }}">{{ character.corporation.alliance.name }}</a></span></li>
|
||||||
<li><span class="stat">Security Status:</span> {{ character.security_status|floatformat:2 }}</span></li>
|
<li><span class="stat">Security Status:</span> {{ character.security_status|floatformat:2 }}</span></li>
|
||||||
<li><span class="stat">Director:</span> <span class="value">{{ character.director }}</span></li>
|
<li><span class="stat">Director:</span> <span class="value">{{ character.director }}</span></li>
|
||||||
{% if current_training %}
|
{% if character.current_training %}
|
||||||
<li><spam class="stat">Training:</span> <span class="Value">{{ current_training.skill.name}} to Level {{ current_training.in_training }}</li>
|
<li><spam class="stat">Training:</span> <span class="Value">{{ character.current_training.skill.name}} to Level {{ character.current_training.in_training }}</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,11 +6,12 @@
|
|||||||
|
|
||||||
{% if characters %}
|
{% if characters %}
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Character Name</th><th>Corporation</th><th>Alliance</th></tr>
|
<tr><th>Character Name</th><th>Corporation</th><th>Alliance</th><th>Training</th></tr>
|
||||||
{% for char in characters %}
|
{% for char in characters %}
|
||||||
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td>
|
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td>
|
||||||
<td><a href="{% url eveapi-corporation char.corporation.id %}">{{ char.corporation }}</a></td>
|
<td><a href="{% url eveapi-corporation char.corporation.id %}">{{ char.corporation }}</a></td>
|
||||||
<td>{% if char.corporation.alliance %}{{ char.corporation.alliance }}{% endif %}</td>
|
<td>{% if char.corporation.alliance %}{{ char.corporation.alliance }}{% endif %}</td>
|
||||||
|
<td>{% if char.current_training %}{{ char.current_training.skill.name }} to Level {{ char.current_training.in_training }}{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user