diff --git a/shiftregister/fallback/admin.py b/shiftregister/fallback/admin.py index bbbbd03..bc59f6e 100644 --- a/shiftregister/fallback/admin.py +++ b/shiftregister/fallback/admin.py @@ -29,9 +29,9 @@ class FallbackAssignmentInline(admin.TabularInline): @admin.register(TeamMember) class TeamMemberAdmin(admin.ModelAdmin): - fields = ("id", "name", "url") + fields = ("id", "name", "comment", "url") readonly_fields = ("id", "url") - list_display = ("name", "shift_count") + list_display = ("name", "comment", "shift_count") ordering = ("name",) inlines = (FallbackAssignmentInline,) actions = (assign_random_shifts, clear_shifts) # , reshuffle_shifts) diff --git a/shiftregister/fallback/migrations/0007_teammember_comment.py b/shiftregister/fallback/migrations/0007_teammember_comment.py new file mode 100644 index 0000000..c38c601 --- /dev/null +++ b/shiftregister/fallback/migrations/0007_teammember_comment.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.4 on 2024-05-19 21:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("fallback", "0006_fallbackassignment_was_full"), + ] + + operations = [ + migrations.AddField( + model_name="teammember", + name="comment", + field=models.CharField(default="", max_length=100), + ), + ] diff --git a/shiftregister/fallback/models.py b/shiftregister/fallback/models.py index 53b18cd..602d81d 100644 --- a/shiftregister/fallback/models.py +++ b/shiftregister/fallback/models.py @@ -18,6 +18,7 @@ def generate_id(): class TeamMember(models.Model): id = models.IntegerField(default=generate_id, editable=False, primary_key=True) name = models.CharField(max_length=100) + comment = models.CharField(max_length=100, default="") fallback_shifts = models.ManyToManyField(Shift, through="FallbackAssignment") def url(self): @@ -165,7 +166,7 @@ class TeamMember(models.Model): assignment.delete() def __str__(self): - return f"{self.name}" + return f"{self.name}{f': {self.comment}' if self.comment else ''}" class FallbackAssignment(models.Model):