diff --git a/apps/api/serializers.py b/apps/api/serializers.py index b261242..8c8352f 100644 --- a/apps/api/serializers.py +++ b/apps/api/serializers.py @@ -111,7 +111,7 @@ class DepartmentSerializer(DynamicModelSerializer): class Meta: model = Department fields = [ - "uuid", "title", "icon" + "uuid", "title", "colour", "backgroundcolour", "order" ] diff --git a/apps/authentication/admin.py b/apps/authentication/admin.py index 458cc78..56761cb 100644 --- a/apps/authentication/admin.py +++ b/apps/authentication/admin.py @@ -18,7 +18,7 @@ class UserAdmin(admin.ModelAdmin): class DepartmentAdmin(admin.ModelAdmin): - list_display = ["uuid", "title", "icon", "get_user_count"] + list_display = ["uuid", "title", "colour", "backgroundcolour", "order", "get_user_count"] @admin.display(description="Users") def get_user_count(self, obj): diff --git a/apps/authentication/fixtures/department.json b/apps/authentication/fixtures/department.json index 632f8be..dfc66ba 100644 --- a/apps/authentication/fixtures/department.json +++ b/apps/authentication/fixtures/department.json @@ -4,7 +4,9 @@ "pk": "4e245769-6b67-4a6e-b804-54a3ceb3b8c0", "fields": { "title": "Development", - "icon": null + "colour": "#1976d2", + "backgroundcolour": "#bbdefb", + "order": 4 } }, { @@ -12,7 +14,9 @@ "pk": "85b46ae8-0a19-48b7-8a21-a01abd78a470", "fields": { "title": "Marketing", - "icon": null + "colour": "#7b1fa2", + "backgroundcolour": "#e1bee7", + "order": 1 } }, { @@ -20,7 +24,9 @@ "pk": "a6517555-0bcc-4baa-8e2f-798916562b1c", "fields": { "title": "Management", - "icon": null + "colour": "#689f38", + "backgroundcolour": "#dcedc8", + "order": 0 } }, { @@ -28,7 +34,9 @@ "pk": "bae35c7a-a929-4465-b70f-03254b0774e0", "fields": { "title": "Sales", - "icon": null + "colour": "#e64a19", + "backgroundcolour": "#ffccbc", + "order": 2 } }, { @@ -36,7 +44,9 @@ "pk": "c2bbabd7-05ac-4bc8-97a3-15bafdb478d9", "fields": { "title": "Business Strategy", - "icon": null + "colour": "#c2185b", + "backgroundcolour": "#f8bbd0", + "order": 3 } } ] diff --git a/apps/authentication/migrations/0001_initial.py b/apps/authentication/migrations/0001_initial.py index 5318556..7d5328f 100644 --- a/apps/authentication/migrations/0001_initial.py +++ b/apps/authentication/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.16 on 2024-01-20 19:15 +# Generated by Django 3.2.16 on 2024-01-22 14:39 import apps.authentication.models from django.db import migrations, models @@ -21,7 +21,9 @@ class Migration(migrations.Migration): fields=[ ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('title', models.CharField(max_length=150)), - ('icon', models.CharField(blank=True, max_length=32, null=True)), + ('colour', models.CharField(max_length=7)), + ('backgroundcolour', models.CharField(max_length=7)), + ('order', models.PositiveIntegerField(default=0)), ], ), migrations.CreateModel( diff --git a/apps/authentication/models.py b/apps/authentication/models.py index 5447fe4..42d6082 100644 --- a/apps/authentication/models.py +++ b/apps/authentication/models.py @@ -31,7 +31,9 @@ class Department(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid4, editable=False) title = models.CharField(max_length=150) - icon = models.CharField(max_length=32, null=True, blank=True) + colour = models.CharField(max_length=7) + backgroundcolour = models.CharField(max_length=7) + order = models.PositiveIntegerField(default=0, blank=False, null=False) def __str__(self): return self.title diff --git a/apps/home/views.py b/apps/home/views.py index d19dc39..1a20e6d 100644 --- a/apps/home/views.py +++ b/apps/home/views.py @@ -31,7 +31,7 @@ class TicketView(TemplateView): def get(self, request): priorities = TicketPriority.objects.all().order_by("order") tags = TicketTag.objects.all().order_by("order") - departments = Department.objects.all() + departments = Department.objects.all().order_by("order") context = { "priorities": priorities,