mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 04:20:17 +02:00
parent
2da78f7793
commit
b31521c758
@ -5,7 +5,7 @@ from django.utils import timezone
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .models import Timer
|
||||
from .models import Timer, TimerType
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
|
||||
class TimerForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Timer
|
||||
fields = ('details', 'system', 'planet_moon', 'structure', 'objective', 'important', 'corp_timer')
|
||||
fields = ('details', 'system', 'planet_moon', 'structure', 'timer_type', 'objective', 'important', 'corp_timer')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.user = kwargs.pop('user', None)
|
||||
@ -59,6 +59,7 @@ class TimerForm(forms.ModelForm):
|
||||
system = forms.CharField(max_length=254, required=True, label=_("System"))
|
||||
planet_moon = forms.CharField(max_length=254, label=_("Planet/Moon"), required=False, initial="")
|
||||
structure = forms.ChoiceField(choices=structure_choices, required=True, label=_("Structure Type"))
|
||||
timer_type = forms.ChoiceField(choices=TimerType.choices, label=_("Timer Type"))
|
||||
objective = forms.ChoiceField(choices=objective_choices, required=True, label=_("Objective"))
|
||||
days_left = forms.IntegerField(required=True, label=_("Days Remaining"), validators=[MinValueValidator(0)])
|
||||
hours_left = forms.IntegerField(required=True, label=_("Hours Remaining"),
|
||||
|
30
allianceauth/timerboard/migrations/0004_timer_type.py
Normal file
30
allianceauth/timerboard/migrations/0004_timer_type.py
Normal file
@ -0,0 +1,30 @@
|
||||
# Generated by Django 3.2.8 on 2021-10-20 13:26
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("timerboard", "0003_on_delete"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="timer",
|
||||
name="timer_type",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("UNSPECIFIED", "Not Specified"),
|
||||
("SHIELD", "Shield"),
|
||||
("ARMOR", "Armor"),
|
||||
("HULL", "Hull"),
|
||||
("FINAL", "Final"),
|
||||
("ANCHORING", "Anchoring"),
|
||||
("UNANCHORING", "Unanchoring"),
|
||||
],
|
||||
default="UNSPECIFIED",
|
||||
max_length=254,
|
||||
),
|
||||
),
|
||||
]
|
@ -1,10 +1,25 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from allianceauth.eveonline.models import EveCharacter
|
||||
from allianceauth.eveonline.models import EveCorporationInfo
|
||||
|
||||
|
||||
class TimerType(models.TextChoices):
|
||||
"""
|
||||
Choices for Timer Type
|
||||
"""
|
||||
|
||||
UNSPECIFIED = "UNSPECIFIED", _("Not Specified")
|
||||
SHIELD = "SHIELD", _("Shield")
|
||||
ARMOR = "ARMOR", _("Armor")
|
||||
HULL = "HULL", _("Hull")
|
||||
FINAL = "FINAL", _("Final")
|
||||
ANCHORING = "ANCHORING", _("Anchoring")
|
||||
UNANCHORING = "UNANCHORING", _("Unanchoring")
|
||||
|
||||
|
||||
class Timer(models.Model):
|
||||
class Meta:
|
||||
ordering = ['eve_time']
|
||||
@ -13,6 +28,11 @@ class Timer(models.Model):
|
||||
system = models.CharField(max_length=254, default="")
|
||||
planet_moon = models.CharField(max_length=254, default="")
|
||||
structure = models.CharField(max_length=254, default="")
|
||||
timer_type = models.CharField(
|
||||
max_length=254,
|
||||
choices=TimerType.choices,
|
||||
default=TimerType.UNSPECIFIED,
|
||||
)
|
||||
objective = models.CharField(max_length=254, default="")
|
||||
eve_time = models.DateTimeField()
|
||||
important = models.BooleanField(default=False)
|
||||
|
@ -46,7 +46,12 @@
|
||||
{% else %}
|
||||
<tr class="info">
|
||||
{% endif %}
|
||||
<td style="width:150px" class="text-center">{{ timer.details }}</td>
|
||||
<td style="width:150px" class="text-center">
|
||||
{{ timer.details }}
|
||||
{% if timer.timer_type != 'UNSPECIFIED' %}
|
||||
({{ timer.get_timer_type_display }})
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if timer.objective == "Hostile" %}
|
||||
<div class="label label-danger">
|
||||
@ -208,7 +213,12 @@
|
||||
{% else %}
|
||||
<tr class="info">
|
||||
{% endif %}
|
||||
<td style="width:150px" class="text-center">{{ timer.details }}</td>
|
||||
<td style="width:150px" class="text-center">
|
||||
{{ timer.details }}
|
||||
{% if timer.timer_type != 'UNSPECIFIED' %}
|
||||
({{ timer.get_timer_type_display }})
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if timer.objective == "Hostile" %}
|
||||
<div class="label label-danger">
|
||||
@ -376,7 +386,12 @@
|
||||
{% else %}
|
||||
<tr class="info">
|
||||
{% endif %}
|
||||
<td style="width:150px" class="text-center">{{ timer.details }}</td>
|
||||
<td style="width:150px" class="text-center">
|
||||
{{ timer.details }}
|
||||
{% if timer.timer_type != 'UNSPECIFIED' %}
|
||||
({{ timer.get_timer_type_display }})
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if timer.objective == "Hostile" %}
|
||||
<div class="label label-danger">
|
||||
|
Loading…
x
Reference in New Issue
Block a user