diff --git a/allianceauth/timerboard/form.py b/allianceauth/timerboard/form.py index d8dc9e71..3a42179b 100755 --- a/allianceauth/timerboard/form.py +++ b/allianceauth/timerboard/form.py @@ -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"), diff --git a/allianceauth/timerboard/migrations/0004_timer_type.py b/allianceauth/timerboard/migrations/0004_timer_type.py new file mode 100644 index 00000000..7c9c4fbf --- /dev/null +++ b/allianceauth/timerboard/migrations/0004_timer_type.py @@ -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, + ), + ), + ] diff --git a/allianceauth/timerboard/models.py b/allianceauth/timerboard/models.py index d5391583..7261ca45 100755 --- a/allianceauth/timerboard/models.py +++ b/allianceauth/timerboard/models.py @@ -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) diff --git a/allianceauth/timerboard/templates/timerboard/view.html b/allianceauth/timerboard/templates/timerboard/view.html index 12eaf05c..6649ccdf 100644 --- a/allianceauth/timerboard/templates/timerboard/view.html +++ b/allianceauth/timerboard/templates/timerboard/view.html @@ -46,7 +46,12 @@ {% else %}