feat(fallback): add comment field to TeamMember
This commit is contained in:
parent
7b4df14bee
commit
15475e2eec
|
@ -29,9 +29,9 @@ class FallbackAssignmentInline(admin.TabularInline):
|
||||||
|
|
||||||
@admin.register(TeamMember)
|
@admin.register(TeamMember)
|
||||||
class TeamMemberAdmin(admin.ModelAdmin):
|
class TeamMemberAdmin(admin.ModelAdmin):
|
||||||
fields = ("id", "name", "url")
|
fields = ("id", "name", "comment", "url")
|
||||||
readonly_fields = ("id", "url")
|
readonly_fields = ("id", "url")
|
||||||
list_display = ("name", "shift_count")
|
list_display = ("name", "comment", "shift_count")
|
||||||
ordering = ("name",)
|
ordering = ("name",)
|
||||||
inlines = (FallbackAssignmentInline,)
|
inlines = (FallbackAssignmentInline,)
|
||||||
actions = (assign_random_shifts, clear_shifts) # , reshuffle_shifts)
|
actions = (assign_random_shifts, clear_shifts) # , reshuffle_shifts)
|
||||||
|
|
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -18,6 +18,7 @@ def generate_id():
|
||||||
class TeamMember(models.Model):
|
class TeamMember(models.Model):
|
||||||
id = models.IntegerField(default=generate_id, editable=False, primary_key=True)
|
id = models.IntegerField(default=generate_id, editable=False, primary_key=True)
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
|
comment = models.CharField(max_length=100, default="")
|
||||||
fallback_shifts = models.ManyToManyField(Shift, through="FallbackAssignment")
|
fallback_shifts = models.ManyToManyField(Shift, through="FallbackAssignment")
|
||||||
|
|
||||||
def url(self):
|
def url(self):
|
||||||
|
@ -165,7 +166,7 @@ class TeamMember(models.Model):
|
||||||
assignment.delete()
|
assignment.delete()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.name}"
|
return f"{self.name}{f': {self.comment}' if self.comment else ''}"
|
||||||
|
|
||||||
|
|
||||||
class FallbackAssignment(models.Model):
|
class FallbackAssignment(models.Model):
|
||||||
|
|
Loading…
Reference in New Issue