From f51523dc07d768ccbdd74a296459172bf7e268d7 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 17:03:00 +0100 Subject: [PATCH] [CHANGE] Use TextChoices displayed name in template --- allianceauth/timerboard/models.py | 6 +- .../templates/timerboard/timertable.html | 80 ++++++++++--------- 2 files changed, 46 insertions(+), 40 deletions(-) diff --git a/allianceauth/timerboard/models.py b/allianceauth/timerboard/models.py index ce14f17e..6823ea8d 100644 --- a/allianceauth/timerboard/models.py +++ b/allianceauth/timerboard/models.py @@ -1,6 +1,6 @@ from django.contrib.auth.models import User from django.db import models -from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy as _ from allianceauth.eveonline.models import EveCharacter from allianceauth.eveonline.models import EveCorporationInfo @@ -36,8 +36,8 @@ class Timer(models.Model): SOTIYO = "Sotiyo", _("Sotiyo") ATHANOR = "Athanor", _("Athanor") TATARA = "Tatara", _("Tatara") - PHAROLUX = "Pharolux Cyno Beacon", _("Pharolux Cyno Beacon") - TENEBREX = "Tenebrex Cyno Jammer", _("Tenebrex Cyno Jammer") + PHAROLUX = "Pharolux Cyno Beacon", _("Cyno Beacon") + TENEBREX = "Tenebrex Cyno Jammer", _("Cyno Jammer") ANSIBLEX = "Ansiblex Jump Gate", _("Ansiblex Jump Gate") MERCDEN = "Mercenary Den", _("Mercenary Den") MOONPOP = "Moon Mining Cycle", _("Moon Mining Cycle") diff --git a/allianceauth/timerboard/templates/timerboard/timertable.html b/allianceauth/timerboard/templates/timerboard/timertable.html index 3ee2c202..455d0d94 100644 --- a/allianceauth/timerboard/templates/timerboard/timertable.html +++ b/allianceauth/timerboard/templates/timerboard/timertable.html @@ -19,7 +19,6 @@ {% for timer in timers %} - {{ timer.details }} @@ -54,62 +53,69 @@ {% comment %} BG: Info {% endcomment %} {% if timer.structure == "POCO" %} -
{% translate "POCO" %}
+
{% elif timer.structure == "POS[S]" %} -
{% translate "POS [S]" %}
+
{% elif timer.structure == "POS[M]" %} -
{% translate "POS [M]" %}
+
{% elif timer.structure == "POS[L]" %} -
{% translate "POS [L]" %}
+
{% comment %} BG: Warning {% endcomment %} - {% elif timer.structure == "Station" %} -
{% translate "Station" %}
+ {% elif timer.structure == "Station" %} {% comment %} Pending Removal {% endcomment %} +
{% elif timer.structure == "Orbital Skyhook" %} -
{% translate "Orbital Skyhook" %}
+
{% elif timer.structure == "I-HUB" %} -
{% translate "I-HUB" %}
- {% elif timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %} -
{% translate "Raitaru" %}
- {% elif timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %} -
{% translate "Azbel" %}
- {% elif timer.structure == "Refinery[M]" or timer.structure == "Athanor" %} -
{% translate "Athanor" %}
- {% elif timer.structure == "Refinery[L]" or timer.structure == "Tatara" %} -
{% translate "Tatara" %}
- {% elif timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %} -
{% translate "Cyno Beacon" %}
- {% elif timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %} -
{% translate "Cyno Jammer" %}
- {% elif timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %} -
{% translate "Ansiblex Jump Gate" %}
+
+ {% elif timer.structure == "Raitaru" %} +
+ {% elif timer.structure == "Azbel" %} +
+ {% elif timer.structure == "Athanor" %} +
+ {% elif timer.structure == "Tatara" %} +
+ {% elif timer.structure == "Pharolux Cyno Beacon" %} +
+ {% elif timer.structure == "Tenebrex Cyno Jammer" %} +
+ {% elif timer.structure == "Ansiblex Jump Gate" %} +
{% elif timer.structure == "Mercenary Den" %} -
{% translate "Mercenary Den" %}
+
{% elif timer.structure == "Metenox Moon Drill" %} -
{% translate "Metenox Moon Drill" %}
+
{% comment %} BG: Danger {% endcomment %} {% elif timer.structure == "TCU" %} -
{% translate "TCU" %}
- {% elif timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %} -
{% translate "Astrahus" %}
- {% elif timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %} -
{% translate "Fortizar" %}
- {% elif timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %} -
{% translate "Keepstar" %}
- {% elif timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %} -
{% translate "Sotiyo" %}
+
+ {% elif timer.structure == "Astrahus" %} +
+ {% elif timer.structure == "Fortizar" %} +
+ {% elif timer.structure == "Keepstar" %} +
+ {% elif timer.structure == "Sotiyo" %} +
{% comment %} BG: Secondary {% endcomment %} {% elif timer.structure == "TCU" %} {% comment %} Pending Removal {% endcomment %} -
{% translate "TCU" %}
+
{% elif timer.structure == "Other" %} -
{% translate "Other" %}
+
{% comment %} BG: Success {% endcomment %} {% elif timer.structure == "Moon Mining Cycle" %} -
{% translate "Moon Mining Cycle" %}
+
+ + {% comment %} BG: Primary (for all other timers) {% endcomment %} + {% else %} +
{% endif %} + + {{ timer.get_structure_display }} +
{{ timer.eve_time | date:"Y-m-d H:i" }}