[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.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")

View File

@ -19,7 +19,6 @@
{% for timer in timers %}
<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">
{{ timer.details }}
@ -54,62 +53,69 @@
<td class="text-center">
{% comment %} BG: Info {% endcomment %}
{% if timer.structure == "POCO" %}
<div class="badge bg-info">{% translate "POCO" %}</div>
<div class="badge bg-info">
{% elif timer.structure == "POS[S]" %}
<div class="badge bg-info">{% translate "POS [S]" %}</div>
<div class="badge bg-info">
{% elif timer.structure == "POS[M]" %}
<div class="badge bg-info">{% translate "POS [M]" %}</div>
<div class="badge bg-info">
{% elif timer.structure == "POS[L]" %}
<div class="badge bg-info">{% translate "POS [L]" %}</div>
<div class="badge bg-info">
{% comment %} BG: Warning {% endcomment %}
{% elif timer.structure == "Station" %}
<div class="badge bg-warning">{% translate "Station" %}</div>
{% elif timer.structure == "Station" %} {% comment %} Pending Removal {% endcomment %}
<div class="badge bg-warning">
{% elif timer.structure == "Orbital Skyhook" %}
<div class="badge bg-warning">{% translate "Orbital Skyhook" %}</div>
<div class="badge bg-warning">
{% elif timer.structure == "I-HUB" %}
<div class="badge bg-warning">{% translate "I-HUB" %}</div>
{% elif timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %}
<div class="badge bg-warning">{% translate "Raitaru" %}</div>
{% elif timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %}
<div class="badge bg-warning">{% translate "Azbel" %}</div>
{% elif timer.structure == "Refinery[M]" or timer.structure == "Athanor" %}
<div class="badge bg-warning">{% translate "Athanor" %}</div>
{% elif timer.structure == "Refinery[L]" or timer.structure == "Tatara" %}
<div class="badge bg-warning">{% translate "Tatara" %}</div>
{% elif timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %}
<div class="badge bg-warning">{% translate "Cyno Beacon" %}</div>
{% elif timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %}
<div class="badge bg-warning">{% translate "Cyno Jammer" %}</div>
{% elif timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %}
<div class="badge bg-warning">{% translate "Ansiblex Jump Gate" %}</div>
<div class="badge bg-warning">
{% elif timer.structure == "Raitaru" %}
<div class="badge bg-warning">
{% elif timer.structure == "Azbel" %}
<div class="badge bg-warning">
{% elif timer.structure == "Athanor" %}
<div class="badge bg-warning">
{% elif timer.structure == "Tatara" %}
<div class="badge bg-warning">
{% elif timer.structure == "Pharolux Cyno Beacon" %}
<div class="badge bg-warning">
{% elif timer.structure == "Tenebrex Cyno Jammer" %}
<div class="badge bg-warning">
{% elif timer.structure == "Ansiblex Jump Gate" %}
<div class="badge bg-warning">
{% 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" %}
<div class="badge bg-warning">{% translate "Metenox Moon Drill" %}</div>
<div class="badge bg-warning">
{% comment %} BG: Danger {% endcomment %}
{% elif timer.structure == "TCU" %}
<div class="badge bg-danger">{% translate "TCU" %}</div>
{% elif timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %}
<div class="badge bg-danger">{% translate "Astrahus" %}</div>
{% elif timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %}
<div class="badge bg-danger">{% translate "Fortizar" %}</div>
{% elif timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %}
<div class="badge bg-danger">{% translate "Keepstar" %}</div>
{% elif timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %}
<div class="badge bg-danger">{% translate "Sotiyo" %}</div>
<div class="badge bg-danger">
{% elif timer.structure == "Astrahus" %}
<div class="badge bg-danger">
{% elif timer.structure == "Fortizar" %}
<div class="badge bg-danger">
{% elif timer.structure == "Keepstar" %}
<div class="badge bg-danger">
{% elif timer.structure == "Sotiyo" %}
<div class="badge bg-danger">
{% comment %} BG: Secondary {% 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" %}
<div class="badge bg-secondary">{% translate "Other" %}</div>
<div class="badge bg-secondary">
{% comment %} BG: Success {% endcomment %}
{% 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 %}
{{ timer.get_structure_display }}
</div>
</td>
<td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td>