diff --git a/drakul/raids/admin.py b/drakul/raids/admin.py index 76944fb..3275a5a 100755 --- a/drakul/raids/admin.py +++ b/drakul/raids/admin.py @@ -5,7 +5,7 @@ from .models import Raid, RaidResponse, RaidComment, InstanceReset class RaidResponseInline(admin.TabularInline): model = RaidResponse - fields = ["character", "role", "status", "attendance", "note"] + fields = ["character", "role", "status", "group", "attendance", "note"] extra = 0 diff --git a/drakul/raids/forms.py b/drakul/raids/forms.py index eaa46d4..eb13f2a 100644 --- a/drakul/raids/forms.py +++ b/drakul/raids/forms.py @@ -109,7 +109,7 @@ class RaidCommentForm(ModelForm): RaidResponseFormSet = inlineformset_factory( Raid, # parent model RaidResponse, - fields=["character", "role", "status", "note", "attendance"], + fields=["character", "role", "status", "group", "note", "attendance"], can_delete=False, extra=1 ) @@ -124,6 +124,7 @@ class RaidResponseFormSetHelper(FormHelper): Field("character", css_class="character-select"), Field("role", css_class="role-select"), Field("status", css_class="status-select"), + Field("group", css_class="group-select"), Field("note"), Field("attendance", css_class="attendance-input"), ) diff --git a/drakul/raids/migrations/0008_auto_20200421_1753.py b/drakul/raids/migrations/0008_auto_20200421_1753.py new file mode 100644 index 0000000..faa0135 --- /dev/null +++ b/drakul/raids/migrations/0008_auto_20200421_1753.py @@ -0,0 +1,22 @@ +# Generated by Django 3.0.2 on 2020-04-21 17:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('raids', '0007_auto_20200421_0256'), + ] + + operations = [ + migrations.AlterModelOptions( + name='raidresponse', + options={'ordering': ['-status', 'group', 'role', 'character__klass', 'character__user__rank', 'character__name']}, + ), + migrations.AddField( + model_name='raidresponse', + name='group', + field=models.PositiveSmallIntegerField(choices=[(1, 'Group 1'), (2, 'Group 2'), (3, 'Group 3'), (4, 'Group 4')], default=1), + ), + ] diff --git a/drakul/raids/models.py b/drakul/raids/models.py index 3c3a624..a9265d7 100755 --- a/drakul/raids/models.py +++ b/drakul/raids/models.py @@ -81,6 +81,17 @@ class RaidResponse(models.Model): choices=Status.choices ) + class Groups(models.IntegerChoices): + GROUP_1 = 1 + GROUP_2 = 2 + GROUP_3 = 3 + GROUP_4 = 4 + + group = models.PositiveSmallIntegerField( + choices=Groups.choices, + default=Groups.GROUP_1 + ) + attendance = models.DecimalField( max_digits=3, decimal_places=2, @@ -93,7 +104,7 @@ class RaidResponse(models.Model): ) class Meta: - ordering = ["-status", "role", "character__klass", "character__user__rank", "character__name"] + ordering = ["-status", "group", "role", "character__klass", "character__user__rank", "character__name"] constraints = [ models.UniqueConstraint(fields=["raid", "character"], name="unique_character_raid_signup") ] diff --git a/drakul/raids/templates/raids/raid_detail.html b/drakul/raids/templates/raids/raid_detail.html index 245b3ce..b90eb58 100644 --- a/drakul/raids/templates/raids/raid_detail.html +++ b/drakul/raids/templates/raids/raid_detail.html @@ -54,44 +54,49 @@ {% regroup raid.responses.all by get_status_display as status_responses_list %} {% for status, status_responses in status_responses_list %} -