[CHANGE] Use TextChoices displayed name in template

This commit is contained in:
Peter Pfeufer 2025-01-06 17:03:00 +01:00
parent bd4dd60c98
commit f51523dc07
No known key found for this signature in database
2 changed files with 46 additions and 40 deletions

View File

@ -1,6 +1,6 @@
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models 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 EveCharacter
from allianceauth.eveonline.models import EveCorporationInfo from allianceauth.eveonline.models import EveCorporationInfo
@ -36,8 +36,8 @@ class Timer(models.Model):
SOTIYO = "Sotiyo", _("Sotiyo") SOTIYO = "Sotiyo", _("Sotiyo")
ATHANOR = "Athanor", _("Athanor") ATHANOR = "Athanor", _("Athanor")
TATARA = "Tatara", _("Tatara") TATARA = "Tatara", _("Tatara")
PHAROLUX = "Pharolux Cyno Beacon", _("Pharolux Cyno Beacon") PHAROLUX = "Pharolux Cyno Beacon", _("Cyno Beacon")
TENEBREX = "Tenebrex Cyno Jammer", _("Tenebrex Cyno Jammer") TENEBREX = "Tenebrex Cyno Jammer", _("Cyno Jammer")
ANSIBLEX = "Ansiblex Jump Gate", _("Ansiblex Jump Gate") ANSIBLEX = "Ansiblex Jump Gate", _("Ansiblex Jump Gate")
MERCDEN = "Mercenary Den", _("Mercenary Den") MERCDEN = "Mercenary Den", _("Mercenary Den")
MOONPOP = "Moon Mining Cycle", _("Moon Mining Cycle") MOONPOP = "Moon Mining Cycle", _("Moon Mining Cycle")

View File

@ -19,7 +19,6 @@
{% for timer in timers %} {% for timer in timers %}
<tr class="{% if timer.important == True %}bg-danger bg-opacity-25{% else %}bg-info bg-opacity-25{% endif %}"> <tr class="{% if timer.important == True %}bg-danger bg-opacity-25{% else %}bg-info bg-opacity-25{% endif %}">
<td style="width: 150px;" class="text-center"> <td style="width: 150px;" class="text-center">
{{ timer.details }} {{ timer.details }}
@ -54,62 +53,69 @@
<td class="text-center"> <td class="text-center">
{% comment %} BG: Info {% endcomment %} {% comment %} BG: Info {% endcomment %}
{% if timer.structure == "POCO" %} {% if timer.structure == "POCO" %}
<div class="badge bg-info">{% translate "POCO" %}</div> <div class="badge bg-info">
{% elif timer.structure == "POS[S]" %} {% elif timer.structure == "POS[S]" %}
<div class="badge bg-info">{% translate "POS [S]" %}</div> <div class="badge bg-info">
{% elif timer.structure == "POS[M]" %} {% elif timer.structure == "POS[M]" %}
<div class="badge bg-info">{% translate "POS [M]" %}</div> <div class="badge bg-info">
{% elif timer.structure == "POS[L]" %} {% elif timer.structure == "POS[L]" %}
<div class="badge bg-info">{% translate "POS [L]" %}</div> <div class="badge bg-info">
{% comment %} BG: Warning {% endcomment %} {% comment %} BG: Warning {% endcomment %}
{% elif timer.structure == "Station" %} {% elif timer.structure == "Station" %} {% comment %} Pending Removal {% endcomment %}
<div class="badge bg-warning">{% translate "Station" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Orbital Skyhook" %} {% elif timer.structure == "Orbital Skyhook" %}
<div class="badge bg-warning">{% translate "Orbital Skyhook" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "I-HUB" %} {% elif timer.structure == "I-HUB" %}
<div class="badge bg-warning">{% translate "I-HUB" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %} {% elif timer.structure == "Raitaru" %}
<div class="badge bg-warning">{% translate "Raitaru" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %} {% elif timer.structure == "Azbel" %}
<div class="badge bg-warning">{% translate "Azbel" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Refinery[M]" or timer.structure == "Athanor" %} {% elif timer.structure == "Athanor" %}
<div class="badge bg-warning">{% translate "Athanor" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Refinery[L]" or timer.structure == "Tatara" %} {% elif timer.structure == "Tatara" %}
<div class="badge bg-warning">{% translate "Tatara" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %} {% elif timer.structure == "Pharolux Cyno Beacon" %}
<div class="badge bg-warning">{% translate "Cyno Beacon" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %} {% elif timer.structure == "Tenebrex Cyno Jammer" %}
<div class="badge bg-warning">{% translate "Cyno Jammer" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %} {% elif timer.structure == "Ansiblex Jump Gate" %}
<div class="badge bg-warning">{% translate "Ansiblex Jump Gate" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Mercenary Den" %} {% elif timer.structure == "Mercenary Den" %}
<div class="badge bg-warning">{% translate "Mercenary Den" %}</div> <div class="badge bg-warning">
{% elif timer.structure == "Metenox Moon Drill" %} {% elif timer.structure == "Metenox Moon Drill" %}
<div class="badge bg-warning">{% translate "Metenox Moon Drill" %}</div> <div class="badge bg-warning">
{% comment %} BG: Danger {% endcomment %} {% comment %} BG: Danger {% endcomment %}
{% elif timer.structure == "TCU" %} {% elif timer.structure == "TCU" %}
<div class="badge bg-danger">{% translate "TCU" %}</div> <div class="badge bg-danger">
{% elif timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %} {% elif timer.structure == "Astrahus" %}
<div class="badge bg-danger">{% translate "Astrahus" %}</div> <div class="badge bg-danger">
{% elif timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %} {% elif timer.structure == "Fortizar" %}
<div class="badge bg-danger">{% translate "Fortizar" %}</div> <div class="badge bg-danger">
{% elif timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %} {% elif timer.structure == "Keepstar" %}
<div class="badge bg-danger">{% translate "Keepstar" %}</div> <div class="badge bg-danger">
{% elif timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %} {% elif timer.structure == "Sotiyo" %}
<div class="badge bg-danger">{% translate "Sotiyo" %}</div> <div class="badge bg-danger">
{% comment %} BG: Secondary {% endcomment %} {% comment %} BG: Secondary {% endcomment %}
{% elif timer.structure == "TCU" %} {% comment %} Pending Removal {% endcomment %} {% elif timer.structure == "TCU" %} {% comment %} Pending Removal {% endcomment %}
<div class="badge bg-secondary">{% translate "TCU" %}</div> <div class="badge bg-secondary">
{% elif timer.structure == "Other" %} {% elif timer.structure == "Other" %}
<div class="badge bg-secondary">{% translate "Other" %}</div> <div class="badge bg-secondary">
{% comment %} BG: Success {% endcomment %} {% comment %} BG: Success {% endcomment %}
{% elif timer.structure == "Moon Mining Cycle" %} {% elif timer.structure == "Moon Mining Cycle" %}
<div class="badge bg-success">{% translate "Moon Mining Cycle" %}</div> <div class="badge bg-success">
{% comment %} BG: Primary (for all other timers) {% endcomment %}
{% else %}
<div class="badge bg-primary">
{% endif %} {% endif %}
{{ timer.get_structure_display }}
</div>
</td> </td>
<td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td> <td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td>