From 17872486509f965c30602cda7c25bb3710c05177 Mon Sep 17 00:00:00 2001 From: Nikolay Zhuravlev Date: Sat, 13 Apr 2024 02:13:10 +0200 Subject: [PATCH] Delete user profile with user --- .../migrations/0006_auto_20240413_0312.py | 20 +++++++++++++++++++ anytask/users/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 anytask/users/migrations/0006_auto_20240413_0312.py diff --git a/anytask/users/migrations/0006_auto_20240413_0312.py b/anytask/users/migrations/0006_auto_20240413_0312.py new file mode 100644 index 00000000..84d48e88 --- /dev/null +++ b/anytask/users/migrations/0006_auto_20240413_0312.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0.13 on 2024-04-13 00:12 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0005_merge_20220122_1951'), + ] + + operations = [ + migrations.AlterField( + model_name='userprofile', + name='user', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/anytask/users/models.py b/anytask/users/models.py index 35fb12e7..7ccd1528 100644 --- a/anytask/users/models.py +++ b/anytask/users/models.py @@ -29,7 +29,7 @@ class UserProfile(models.Model): blank=False, unique=True, related_name="profile", - on_delete=models.DO_NOTHING, + on_delete=models.CASCADE, ) middle_name = models.CharField(max_length=128, db_index=True, null=True, blank=True) user_status = models.ManyToManyField(UserStatus, db_index=True, blank=True, related_name='users_by_status')