mirror of
https://github.com/Crocmagnon/charasheet.git
synced 2024-11-05 06:13:55 +01:00
Display modifiers as modifiers
This commit is contained in:
parent
c2b2a156a2
commit
237cfbe141
3 changed files with 21 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
{% extends "common/base.html" %}
|
{% extends "common/base.html" %}
|
||||||
|
{% load character_extras %}
|
||||||
|
|
||||||
{% block title %}{{ character.name }}{% endblock %}
|
{% block title %}{{ character.name }}{% endblock %}
|
||||||
|
|
||||||
|
@ -28,32 +29,32 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">FOR</th>
|
<th scope="row">FOR</th>
|
||||||
<td>{{ character.value_strength }}</td>
|
<td>{{ character.value_strength }}</td>
|
||||||
<td>{{ character.modifier_strength }}</td>
|
<td>{{ character.modifier_strength|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">DEX</th>
|
<th scope="row">DEX</th>
|
||||||
<td>{{ character.value_dexterity }}</td>
|
<td>{{ character.value_dexterity }}</td>
|
||||||
<td>{{ character.modifier_dexterity }}</td>
|
<td>{{ character.modifier_dexterity|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">CON</th>
|
<th scope="row">CON</th>
|
||||||
<td>{{ character.value_constitution }}</td>
|
<td>{{ character.value_constitution }}</td>
|
||||||
<td>{{ character.modifier_constitution }}</td>
|
<td>{{ character.modifier_constitution|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">INT</th>
|
<th scope="row">INT</th>
|
||||||
<td>{{ character.value_intelligence }}</td>
|
<td>{{ character.value_intelligence }}</td>
|
||||||
<td>{{ character.modifier_intelligence }}</td>
|
<td>{{ character.modifier_intelligence|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">SAG</th>
|
<th scope="row">SAG</th>
|
||||||
<td>{{ character.value_wisdom }}</td>
|
<td>{{ character.value_wisdom }}</td>
|
||||||
<td>{{ character.modifier_wisdom }}</td>
|
<td>{{ character.modifier_wisdom|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">CHA</th>
|
<th scope="row">CHA</th>
|
||||||
<td>{{ character.value_charisma }}</td>
|
<td>{{ character.value_charisma }}</td>
|
||||||
<td>{{ character.modifier_charisma }}</td>
|
<td>{{ character.modifier_charisma|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -70,15 +71,15 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Att. contact</th>
|
<th scope="row">Att. contact</th>
|
||||||
<td>{{ character.attack_melee }}</td>
|
<td>{{ character.attack_melee|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Att. distance</th>
|
<th scope="row">Att. distance</th>
|
||||||
<td>{{ character.attack_range }}</td>
|
<td>{{ character.attack_range|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Att. magique</th>
|
<th scope="row">Att. magique</th>
|
||||||
<td>{{ character.attack_magic }}</td>
|
<td>{{ character.attack_magic|modifier }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Défense</th>
|
<th scope="row">Défense</th>
|
||||||
|
|
0
src/character/templatetags/__init__.py
Normal file
0
src/character/templatetags/__init__.py
Normal file
11
src/character/templatetags/character_extras.py
Normal file
11
src/character/templatetags/character_extras.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def modifier(value):
|
||||||
|
if value > 0:
|
||||||
|
return f"+{value}"
|
||||||
|
else:
|
||||||
|
return value
|
Loading…
Reference in a new issue