added uuid for Department model

This commit is contained in:
Corban-Lee Jones 2024-01-08 00:40:45 +00:00
parent b3b8d481fa
commit 3089c1fa01
3 changed files with 6 additions and 22 deletions

View File

@ -1,19 +0,0 @@
# Generated by Django 3.2.16 on 2024-01-05 22:09
import apps.authentication.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authentication', 'default_departments'),
]
operations = [
migrations.AlterField(
model_name='user',
name='icon',
field=models.ImageField(default='users/default.webp', upload_to=apps.authentication.models.IconPathGenerator(), verbose_name='profile picture'),
),
]

View File

@ -1,5 +1,6 @@
# Generated by Django 3.2.16 on 2024-01-05 12:04
# Generated by Django 3.2.16 on 2024-01-07 18:45
import apps.authentication.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
@ -18,7 +19,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Department',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('id', 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)),
],
@ -29,7 +30,7 @@ class Migration(migrations.Migration):
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('icon', models.ImageField(default='users/default.webp', upload_to='users', verbose_name='profile picture')),
('icon', models.ImageField(default='../static/assets/images/defaultuser.webp', storage=apps.authentication.models.OverwriteStorage(), upload_to=apps.authentication.models.IconPathGenerator(), verbose_name='profile picture')),
('email', models.EmailField(error_messages={'unique': 'A user with this email address already exists.'}, max_length=254, unique=True, verbose_name='email address')),
('forename', models.CharField(help_text='This should be your real first name.', max_length=150, verbose_name='first name')),
('surname', models.CharField(help_text='This should be your real last name.', max_length=150, verbose_name='last name')),

View File

@ -27,6 +27,8 @@ class IconPathGenerator:
class Department(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
title = models.CharField(max_length=150)
icon = models.CharField(max_length=32, null=True, blank=True)