add achievements field to user model

This commit is contained in:
Timur
2025-03-02 15:17:38 +03:00
parent b631b09648
commit 05f8300976
4 changed files with 44 additions and 1 deletions
@@ -0,0 +1,19 @@
# Generated by Django 5.1.6 on 2025-03-02 12:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('achievement', '0001_initial'),
('user', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='achievements',
field=models.ManyToManyField(blank=True, to='achievement.achievement', verbose_name='ачивки пользователя'),
),
]
+4
View File
@@ -1,6 +1,7 @@
from django.contrib.auth.hashers import check_password, make_password
from django.db import models
from apps.achievement.models import Achievement
from apps.core.models import BaseModel
@@ -16,6 +17,9 @@ class User(BaseModel):
created_at = models.DateTimeField(auto_now=True)
achievements = models.ManyToManyField(Achievement, blank=True,
verbose_name="ачивки пользователя")
@staticmethod
def make_password(password: str):
return make_password(password)