Skip to content

Commit 582dac6

Browse files
Fix backend (#4035)
add
1 parent c75d300 commit 582dac6

File tree

5 files changed

+560
-504
lines changed

5 files changed

+560
-504
lines changed

backend/django_core/apps/anime/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from django.core.management import call_command
55
from django.db.models import Q
66
from django.utils import timezone
7-
from modern_colorthief import ColorThief
7+
from modern_colorthief import get_color
88
from PIL import Image, ImageStat
99
from utilities.rgb_to_hex import rgb_to_hex
1010

@@ -78,7 +78,7 @@ def set_field_color(
7878
instance = AnimeModel.objects.get(pk=pk)
7979

8080
if image_field := getattr(instance, image_field_name):
81-
color = ColorThief(image_field.path).get_color(quality=1)
81+
color = get_color(image_field.path, quality=1)
8282
rgb_value_to_hex = rgb_to_hex(color[0], color[1], color[2])
8383
setattr(
8484
instance,

backend/django_core/apps/user/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CustomUserAdmin(DjangoUserAdmin):
3232
"is_active",
3333
)
3434
readonly_fields = (
35-
"created_at",
35+
# "created_at",
3636
"last_login",
3737
)
3838

@@ -74,7 +74,7 @@ class CustomUserAdmin(DjangoUserAdmin):
7474
_("Important dates"),
7575
{
7676
"fields": (
77-
"created_at",
77+
# "created_at",
7878
"last_login",
7979
)
8080
},
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 5.1 on 2024-09-01 13:03
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('user', '0010_customuser_created_at_alter_customuser_username'),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name='customuser',
15+
name='created_at',
16+
),
17+
]

backend/django_core/apps/user/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
from drf_spectacular.types import OpenApiTypes
1313
from .managers import UserManager
1414
from .validators import username_validator
15-
from mixins.models.created_at import CreatedAtMixin
1615

1716
avatar = FilePattern(filename_pattern="avatar/{uuid:s}{ext}")
1817

1918

2019
# Create your models here.
2120

2221

23-
class CustomUser(AbstractBaseUser, PermissionsMixin, CreatedAtMixin):
22+
class CustomUser(AbstractBaseUser, PermissionsMixin):
2423
username = models.CharField(
2524
_("username"),
2625
max_length=150,
@@ -60,6 +59,7 @@ class CustomUser(AbstractBaseUser, PermissionsMixin, CreatedAtMixin):
6059
"Unselect this instead of deleting accounts."
6160
),
6261
)
62+
date_joined = models.DateTimeField(_("date joined"), default=timezone.now)
6363

6464
avatar = models.ImageField(
6565
upload_to=avatar,

0 commit comments

Comments
 (0)