From 4ca64f41954b970cf7f7151d3c85453401ccadc0 Mon Sep 17 00:00:00 2001 From: moonlitgrace Date: Wed, 4 Dec 2024 21:48:15 +0530 Subject: [PATCH] refactor: quib model made fields required --- ...8_alter_quib_quibber_alter_quib_quiblet.py | 35 +++++++++++++++++++ backend/apps/quiblet/models.py | 5 +-- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 backend/apps/quiblet/migrations/0018_alter_quib_quibber_alter_quib_quiblet.py diff --git a/backend/apps/quiblet/migrations/0018_alter_quib_quibber_alter_quib_quiblet.py b/backend/apps/quiblet/migrations/0018_alter_quib_quibber_alter_quib_quiblet.py new file mode 100644 index 0000000..d8d399d --- /dev/null +++ b/backend/apps/quiblet/migrations/0018_alter_quib_quibber_alter_quib_quiblet.py @@ -0,0 +1,35 @@ +# Generated by Django 5.1.3 on 2024-12-04 16:17 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('quiblet', '0017_alter_quib_id_alter_quiblet_id'), + ('user', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='quib', + name='quibber', + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='quibs', + to='user.profile', + verbose_name='quibber', + ), + ), + migrations.AlterField( + model_name='quib', + name='quiblet', + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='quibs', + to='quiblet.quiblet', + verbose_name='quiblet', + ), + ), + ] diff --git a/backend/apps/quiblet/models.py b/backend/apps/quiblet/models.py index 5be26ad..d6a0aa1 100644 --- a/backend/apps/quiblet/models.py +++ b/backend/apps/quiblet/models.py @@ -47,16 +47,13 @@ class Quib(CreatedAtMixin, IsPublicMixin, ShortUUIDMixin): Quiblet, related_name='quibs', verbose_name=_('quiblet'), - blank=True, on_delete=models.CASCADE, ) quibber = models.ForeignKey( Profile, related_name='quibs', - blank=True, - null=True, verbose_name=_('quibber'), - on_delete=models.SET_NULL, + on_delete=models.CASCADE, ) title = models.CharField(_('title'), max_length=255) slug = models.SlugField(_('slug'), editable=False, max_length=25, blank=True)