moved from migrations to fixtures for default data
This commit is contained in:
parent
f49e7e7702
commit
03de8540b0
@ -1,35 +0,0 @@
|
||||
# Generated by Django 3.2.16 on 2024-01-05 10:44
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.apps import apps
|
||||
import uuid
|
||||
|
||||
|
||||
def create_departments(app, schema_editor):
|
||||
|
||||
Department = apps.get_model("authentication", "Department")
|
||||
|
||||
data = [
|
||||
{"title": "Development", "icon": None},
|
||||
{"title": "Sales", "icon": None},
|
||||
{"title": "Marketing", "icon": None},
|
||||
{"title": "Management", "icon": None},
|
||||
{"title": "Business Strategy", "icon": None},
|
||||
]
|
||||
|
||||
for item in data:
|
||||
priority = Department.objects.create(title=item["title"], icon=item["icon"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("authentication", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_departments)
|
||||
]
|
42
apps/fixtures/authentication/defaultuser.json
Normal file
42
apps/fixtures/authentication/defaultuser.json
Normal file
@ -0,0 +1,42 @@
|
||||
[
|
||||
{
|
||||
"model": "authentication.user",
|
||||
"pk": "291cc4c1-3bb3-4417-aaa6-748606fede77",
|
||||
"fields": {
|
||||
"password": "pbkdf2_sha256$260000$h4zLYmIeMQgJ0ko41i6dxo$Gwe0TV75ibdJTtqdTOOs5ucOEhA9DUM/bwxjagVhKKg=",
|
||||
"last_login": null,
|
||||
"icon": "../static/assets/images/defaultuser.webp",
|
||||
"email": "user@mail.com",
|
||||
"forename": "Default",
|
||||
"surname": "User",
|
||||
"department": null,
|
||||
"create_timestamp": "2024-01-08T23:16:17Z",
|
||||
"edit_timestamp": "2024-01-08T23:17:01.102Z",
|
||||
"is_active": true,
|
||||
"is_staff": false,
|
||||
"is_superuser": false,
|
||||
"groups": [],
|
||||
"user_permissions": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "authentication.user",
|
||||
"pk": "4965745e-b82a-4496-80e1-055217a780b0",
|
||||
"fields": {
|
||||
"password": "pbkdf2_sha256$260000$h4zLYmIeMQgJ0ko41i6dxo$Gwe0TV75ibdJTtqdTOOs5ucOEhA9DUM/bwxjagVhKKg=",
|
||||
"last_login": "2024-01-08T23:15:16.884Z",
|
||||
"icon": "../static/assets/images/defaultuser.webp",
|
||||
"email": "admin@mail.com",
|
||||
"forename": "Default",
|
||||
"surname": "Admin User",
|
||||
"department": null,
|
||||
"create_timestamp": "2024-01-08T23:14:13.402Z",
|
||||
"edit_timestamp": "2024-01-08T23:14:13.444Z",
|
||||
"is_active": true,
|
||||
"is_staff": true,
|
||||
"is_superuser": true,
|
||||
"groups": [],
|
||||
"user_permissions": []
|
||||
}
|
||||
}
|
||||
]
|
42
apps/fixtures/authentication/department.json
Normal file
42
apps/fixtures/authentication/department.json
Normal file
@ -0,0 +1,42 @@
|
||||
[
|
||||
{
|
||||
"model": "authentication.department",
|
||||
"pk": "4e245769-6b67-4a6e-b804-54a3ceb3b8c0",
|
||||
"fields": {
|
||||
"title": "Development",
|
||||
"icon": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "authentication.department",
|
||||
"pk": "85b46ae8-0a19-48b7-8a21-a01abd78a470",
|
||||
"fields": {
|
||||
"title": "Marketing",
|
||||
"icon": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "authentication.department",
|
||||
"pk": "a6517555-0bcc-4baa-8e2f-798916562b1c",
|
||||
"fields": {
|
||||
"title": "Management",
|
||||
"icon": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "authentication.department",
|
||||
"pk": "bae35c7a-a929-4465-b70f-03254b0774e0",
|
||||
"fields": {
|
||||
"title": "Sales",
|
||||
"icon": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "authentication.department",
|
||||
"pk": "c2bbabd7-05ac-4bc8-97a3-15bafdb478d9",
|
||||
"fields": {
|
||||
"title": "Business Strategy",
|
||||
"icon": null
|
||||
}
|
||||
}
|
||||
]
|
38
apps/fixtures/home/ticketpriority.json
Normal file
38
apps/fixtures/home/ticketpriority.json
Normal file
@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"model": "home.ticketpriority",
|
||||
"pk": "0ebc194c-b856-4e4f-9def-cd190d1e8d43",
|
||||
"fields": {
|
||||
"title": "Low",
|
||||
"colour": "#FFFFFF",
|
||||
"backgroundcolour": "#66DD66"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.ticketpriority",
|
||||
"pk": "a680328f-0680-456c-8e26-f594e05989ad",
|
||||
"fields": {
|
||||
"title": "High",
|
||||
"colour": "#FFFFFF",
|
||||
"backgroundcolour": "#FF884D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.ticketpriority",
|
||||
"pk": "d140a5be-cf24-4250-8b38-31338e69dffd",
|
||||
"fields": {
|
||||
"title": "Urgent",
|
||||
"colour": "#FFFFFF",
|
||||
"backgroundcolour": "#FF4D4D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.ticketpriority",
|
||||
"pk": "e79687c6-9054-4706-b9a2-34afccfaa7c8",
|
||||
"fields": {
|
||||
"title": "Normal",
|
||||
"colour": "#FFFFFF",
|
||||
"backgroundcolour": "#66CC66"
|
||||
}
|
||||
}
|
||||
]
|
56
apps/fixtures/home/tickettag.json
Normal file
56
apps/fixtures/home/tickettag.json
Normal file
@ -0,0 +1,56 @@
|
||||
[
|
||||
{
|
||||
"model": "home.tickettag",
|
||||
"pk": "0ac68e5d-9000-4fcb-bb44-40b1b0faaa2b",
|
||||
"fields": {
|
||||
"title": "Issue",
|
||||
"colour": "#000000",
|
||||
"backgroundcolour": "#FFB2B2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.tickettag",
|
||||
"pk": "28b160b5-5c8b-43a5-84d1-4179bde87e6f",
|
||||
"fields": {
|
||||
"title": "Network",
|
||||
"colour": "#000000",
|
||||
"backgroundcolour": "#BFD3C1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.tickettag",
|
||||
"pk": "72fb255c-132f-4124-802d-f4c051620540",
|
||||
"fields": {
|
||||
"title": "Requires Help",
|
||||
"colour": "#000000",
|
||||
"backgroundcolour": "#B2E57C"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.tickettag",
|
||||
"pk": "cc473838-acaf-43f9-a601-dc4ab1f9026c",
|
||||
"fields": {
|
||||
"title": "Software",
|
||||
"colour": "#000000",
|
||||
"backgroundcolour": "#FED8B1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.tickettag",
|
||||
"pk": "dc4dc2d5-2784-4726-8a4e-99df35a143d2",
|
||||
"fields": {
|
||||
"title": "Question",
|
||||
"colour": "#000000",
|
||||
"backgroundcolour": "#FFFCB1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "home.tickettag",
|
||||
"pk": "e8c7e801-57c3-4699-a4f4-4308fb489f60",
|
||||
"fields": {
|
||||
"title": "Hardware",
|
||||
"colour": "#FFFFFF",
|
||||
"backgroundcolour": "#CCCCCC"
|
||||
}
|
||||
}
|
||||
]
|
@ -1,34 +0,0 @@
|
||||
# Generated by Django 3.2.16 on 2024-01-05 10:44
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.apps import apps
|
||||
import uuid
|
||||
|
||||
|
||||
def create_priorities(app, schema_editor):
|
||||
|
||||
TicketPriority = apps.get_model("home", "TicketPriority")
|
||||
|
||||
data = [
|
||||
{"title": "Urgent", "colour": "#FFFFFF", "backgroundcolour": "#FF4D4D"},
|
||||
{"title": "High", "colour": "#FFFFFF", "backgroundcolour": "#FF884D"},
|
||||
{"title": "Normal", "colour": "#FFFFFF", "backgroundcolour": "#66CC66"},
|
||||
{"title": "Low", "colour": "#FFFFFF", "backgroundcolour": "#66DD66"}
|
||||
]
|
||||
|
||||
for item in data:
|
||||
priority = TicketPriority.objects.create(title=item["title"], colour=item["colour"], backgroundcolour=item["backgroundcolour"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("home", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_priorities)
|
||||
]
|
@ -1,36 +0,0 @@
|
||||
# Generated by Django 3.2.16 on 2024-01-05 10:44
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.apps import apps
|
||||
import uuid
|
||||
|
||||
|
||||
def create_tags(app, schema_editor):
|
||||
|
||||
TicketTag = apps.get_model("home", "TicketTag")
|
||||
|
||||
data = [
|
||||
{"title": "Network", "colour": "#000000", "backgroundcolour": "#BFD3C1"},
|
||||
{"title": "Software", "colour": "#000000", "backgroundcolour": "#FED8B1"},
|
||||
{"title": "Hardware", "colour": "#FFFFFF", "backgroundcolour": "#CCCCCC"},
|
||||
{"title": "Question", "colour": "#000000", "backgroundcolour": "#FFFCB1"},
|
||||
{"title": "Requires Help", "colour": "#000000", "backgroundcolour": "#B2E57C"},
|
||||
{"title": "Issue", "colour": "#000000", "backgroundcolour": "#FFB2B2"}
|
||||
]
|
||||
|
||||
for item in data:
|
||||
priority = TicketTag.objects.create(title=item["title"], colour=item["colour"], backgroundcolour=item["backgroundcolour"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("home", "default_priorities"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_tags)
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user