Department colours and order

This commit is contained in:
Corban-Lee Jones 2024-01-22 16:31:59 +00:00
parent 2fb6ea6c64
commit 2364277c1a
6 changed files with 25 additions and 11 deletions

View File

@ -111,7 +111,7 @@ class DepartmentSerializer(DynamicModelSerializer):
class Meta:
model = Department
fields = [
"uuid", "title", "icon"
"uuid", "title", "colour", "backgroundcolour", "order"
]

View File

@ -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):

View File

@ -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
}
}
]

View File

@ -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(

View File

@ -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

View File

@ -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,