diff --git a/backend/.gitignore b/backend/.gitignore index 5dab7509..8a76aede 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -9,10 +9,9 @@ __pycache__/ local_settings.py db.sqlite3 db.sqlite3-journal -# ignore all files inside media (not folders) # media media/**/* -!media/**/*.gitkeep +!media/.gitkeep # Generated graphs graph_*.png # # Ignore all files in migrations folders diff --git a/backend/apps/quiblet/migrations/0001_initial.py b/backend/apps/quiblet/migrations/0001_initial.py index 192640e2..ef76e101 100644 --- a/backend/apps/quiblet/migrations/0001_initial.py +++ b/backend/apps/quiblet/migrations/0001_initial.py @@ -1,6 +1,7 @@ -# Generated by Django 5.1.3 on 2024-12-01 17:12 +# Generated by Django 5.1.3 on 2024-12-06 15:53 import dynamic_filenames +import shortuuid.django_fields from django.db import migrations, models @@ -8,23 +9,48 @@ class Migration(migrations.Migration): initial = True - dependencies = [ - ('user', '0001_initial'), - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Quiblet', + name='Quib', fields=[ + ( + 'created_at', + models.DateTimeField(auto_now_add=True, verbose_name='create at'), + ), + ('is_public', models.BooleanField(default=True, verbose_name='is public')), ( 'id', - models.BigAutoField( - auto_created=True, + shortuuid.django_fields.ShortUUIDField( + alphabet='abcdefghijklmnopqrstuvwxyz0123456789', + editable=False, + length=7, + max_length=7, + prefix='', primary_key=True, serialize=False, - verbose_name='ID', + verbose_name='id', ), ), + ('title', models.CharField(max_length=255, verbose_name='title')), + ( + 'slug', + models.SlugField( + blank=True, editable=False, max_length=25, verbose_name='slug' + ), + ), + ('content', models.TextField(verbose_name='content')), + ], + options={ + 'verbose_name': 'Quib', + 'verbose_name_plural': 'Quibs', + 'ordering': ['-created_at'], + }, + ), + migrations.CreateModel( + name='Quiblet', + fields=[ ( 'created_at', models.DateTimeField(auto_now_add=True, verbose_name='create at'), @@ -40,6 +66,20 @@ class Migration(migrations.Migration): verbose_name='avatar', ), ), + ('is_public', models.BooleanField(default=True, verbose_name='is public')), + ( + 'id', + shortuuid.django_fields.ShortUUIDField( + alphabet='abcdefghijklmnopqrstuvwxyz0123456789', + editable=False, + length=7, + max_length=7, + prefix='', + primary_key=True, + serialize=False, + verbose_name='id', + ), + ), ('name', models.CharField(max_length=25, unique=True, verbose_name='name')), ('description', models.TextField(verbose_name='description')), ( @@ -53,25 +93,6 @@ class Migration(migrations.Migration): verbose_name='cover', ), ), - ('is_public', models.BooleanField(default=True, verbose_name='is public')), - ( - 'members', - models.ManyToManyField( - blank=True, - related_name='quiblets', - to='user.profile', - verbose_name='members', - ), - ), - ( - 'rangers', - models.ManyToManyField( - blank=True, - related_name='ranged_quiblets', - to='user.profile', - verbose_name='rangers', - ), - ), ], options={ 'verbose_name': 'Quiblet', diff --git a/backend/apps/quiblet/migrations/0002_alter_quiblet_members.py b/backend/apps/quiblet/migrations/0002_alter_quiblet_members.py deleted file mode 100644 index 704d410c..00000000 --- a/backend/apps/quiblet/migrations/0002_alter_quiblet_members.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-01 17:51 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0001_initial'), - ('user', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='quiblet', - name='members', - field=models.ManyToManyField( - blank=True, - related_name='joined_quiblets', - to='user.profile', - verbose_name='members', - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0002_initial.py b/backend/apps/quiblet/migrations/0002_initial.py new file mode 100644 index 00000000..0677f133 --- /dev/null +++ b/backend/apps/quiblet/migrations/0002_initial.py @@ -0,0 +1,85 @@ +# Generated by Django 5.1.3 on 2024-12-06 15:53 + +import django.db.models.deletion +import django.db.models.functions.text +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('quiblet', '0001_initial'), + ('user', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='quib', + name='dislikes', + field=models.ManyToManyField( + blank=True, + related_name='disliked_quibs', + to='user.profile', + verbose_name='dislikes', + ), + ), + migrations.AddField( + model_name='quib', + name='likes', + field=models.ManyToManyField( + blank=True, + related_name='liked_quibs', + to='user.profile', + verbose_name='likes', + ), + ), + migrations.AddField( + 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.AddField( + model_name='quiblet', + name='members', + field=models.ManyToManyField( + blank=True, + related_name='joined_quiblets', + to='user.profile', + verbose_name='members', + ), + ), + migrations.AddField( + model_name='quiblet', + name='rangers', + field=models.ManyToManyField( + blank=True, + related_name='ranged_quiblets', + to='user.profile', + verbose_name='rangers', + ), + ), + migrations.AddField( + model_name='quib', + name='quiblet', + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='quibs', + to='quiblet.quiblet', + verbose_name='quiblet', + ), + ), + migrations.AddConstraint( + model_name='quiblet', + constraint=models.UniqueConstraint( + django.db.models.functions.text.Lower('name'), + name='unique_quiblet_name_case_insensitive', + ), + ), + ] diff --git a/backend/apps/quiblet/migrations/0003_quiblet_unique_quiblet_name_case_insensitive.py b/backend/apps/quiblet/migrations/0003_quiblet_unique_quiblet_name_case_insensitive.py deleted file mode 100644 index 80fa233b..00000000 --- a/backend/apps/quiblet/migrations/0003_quiblet_unique_quiblet_name_case_insensitive.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-02 01:47 - -import django.db.models.functions.text -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0002_alter_quiblet_members'), - ('user', '0001_initial'), - ] - - operations = [ - migrations.AddConstraint( - model_name='quiblet', - constraint=models.UniqueConstraint( - django.db.models.functions.text.Lower('name'), - name='unique_quiblet_name_case_insensitive', - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0004_quib.py b/backend/apps/quiblet/migrations/0004_quib.py deleted file mode 100644 index 0ce8fa55..00000000 --- a/backend/apps/quiblet/migrations/0004_quib.py +++ /dev/null @@ -1,77 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-02 12:02 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0003_quiblet_unique_quiblet_name_case_insensitive'), - ('user', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='Quib', - fields=[ - ( - 'id', - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name='ID', - ), - ), - ( - 'created_at', - models.DateTimeField(auto_now_add=True, verbose_name='create at'), - ), - ('title', models.CharField(max_length=255, verbose_name='title')), - ('slug', models.SlugField(max_length=25, verbose_name='slug')), - ('content', models.TextField(verbose_name='content')), - ( - 'dislikes', - models.ManyToManyField( - blank=True, - related_name='disliked_quibs', - to='user.profile', - verbose_name='dislikes', - ), - ), - ( - 'likes', - models.ManyToManyField( - blank=True, - related_name='liked_quibs', - to='user.profile', - verbose_name='likes', - ), - ), - ( - 'quibbler', - models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name='quibbled_quibs', - to='user.profile', - verbose_name='quibbler', - ), - ), - ( - 'quiblet', - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name='quibs', - to='quiblet.quiblet', - verbose_name='quibs', - ), - ), - ], - options={ - 'verbose_name': 'Quib', - 'verbose_name_plural': 'Quibs', - }, - ), - ] diff --git a/backend/apps/quiblet/migrations/0005_alter_quib_quibbler_alter_quib_quiblet.py b/backend/apps/quiblet/migrations/0005_alter_quib_quibbler_alter_quib_quiblet.py deleted file mode 100644 index adc7ca62..00000000 --- a/backend/apps/quiblet/migrations/0005_alter_quib_quibbler_alter_quib_quiblet.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-02 12:03 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0004_quib'), - ('user', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='quibbler', - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name='quibbled_quibs', - to='user.profile', - verbose_name='quibbler', - ), - ), - migrations.AlterField( - model_name='quib', - name='quiblet', - field=models.ForeignKey( - blank=True, - on_delete=django.db.models.deletion.CASCADE, - related_name='quibs', - to='quiblet.quiblet', - verbose_name='quibs', - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0006_quib_is_draft_alter_quib_quiblet.py b/backend/apps/quiblet/migrations/0006_quib_is_draft_alter_quib_quiblet.py deleted file mode 100644 index d3baec14..00000000 --- a/backend/apps/quiblet/migrations/0006_quib_is_draft_alter_quib_quiblet.py +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-02 12:13 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0005_alter_quib_quibbler_alter_quib_quiblet'), - ] - - operations = [ - migrations.AddField( - model_name='quib', - name='is_draft', - field=models.BooleanField(default=False), - ), - migrations.AlterField( - model_name='quib', - name='quiblet', - field=models.ForeignKey( - blank=True, - on_delete=django.db.models.deletion.CASCADE, - related_name='quibs', - to='quiblet.quiblet', - verbose_name='quiblet', - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0007_remove_quib_is_draft_quib_is_public.py b/backend/apps/quiblet/migrations/0007_remove_quib_is_draft_quib_is_public.py deleted file mode 100644 index a30eb5a4..00000000 --- a/backend/apps/quiblet/migrations/0007_remove_quib_is_draft_quib_is_public.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-02 12:14 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0006_quib_is_draft_alter_quib_quiblet'), - ] - - operations = [ - migrations.RemoveField( - model_name='quib', - name='is_draft', - ), - migrations.AddField( - model_name='quib', - name='is_public', - field=models.BooleanField(default=True), - ), - ] diff --git a/backend/apps/quiblet/migrations/0008_alter_quib_slug.py b/backend/apps/quiblet/migrations/0008_alter_quib_slug.py deleted file mode 100644 index fabef97d..00000000 --- a/backend/apps/quiblet/migrations/0008_alter_quib_slug.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-02 12:22 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0007_remove_quib_is_draft_quib_is_public'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='slug', - field=models.SlugField(editable=False, max_length=25, verbose_name='slug'), - ), - ] diff --git a/backend/apps/quiblet/migrations/0009_remove_quib_quibbler_quib_quibber.py b/backend/apps/quiblet/migrations/0009_remove_quib_quibbler_quib_quibber.py deleted file mode 100644 index df561448..00000000 --- a/backend/apps/quiblet/migrations/0009_remove_quib_quibbler_quib_quibber.py +++ /dev/null @@ -1,31 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 06:39 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0008_alter_quib_slug'), - ('user', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='quib', - name='quibbler', - ), - migrations.AddField( - model_name='quib', - name='quibber', - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name='quibs', - to='user.profile', - verbose_name='quibber', - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0010_alter_quib_is_public.py b/backend/apps/quiblet/migrations/0010_alter_quib_is_public.py deleted file mode 100644 index be9caf4c..00000000 --- a/backend/apps/quiblet/migrations/0010_alter_quib_is_public.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 06:43 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0009_remove_quib_quibbler_quib_quibber'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='is_public', - field=models.BooleanField(default=True, verbose_name='is public'), - ), - ] diff --git a/backend/apps/quiblet/migrations/0011_alter_quib_id_alter_quiblet_id.py b/backend/apps/quiblet/migrations/0011_alter_quib_id_alter_quiblet_id.py deleted file mode 100644 index d30016fb..00000000 --- a/backend/apps/quiblet/migrations/0011_alter_quib_id_alter_quiblet_id.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 15:39 - -import shortuuid.django_fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0010_alter_quib_is_public'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet=None, - length=22, - max_length=16, - prefix='', - primary_key=True, - serialize=False, - ), - ), - migrations.AlterField( - model_name='quiblet', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet=None, - length=22, - max_length=16, - prefix='', - primary_key=True, - serialize=False, - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0012_alter_quib_id_alter_quiblet_id.py b/backend/apps/quiblet/migrations/0012_alter_quib_id_alter_quiblet_id.py deleted file mode 100644 index 5972957b..00000000 --- a/backend/apps/quiblet/migrations/0012_alter_quib_id_alter_quiblet_id.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 15:41 - -import shortuuid.django_fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0011_alter_quib_id_alter_quiblet_id'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet=None, - length=6, - max_length=6, - prefix='', - primary_key=True, - serialize=False, - ), - ), - migrations.AlterField( - model_name='quiblet', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet=None, - length=6, - max_length=6, - prefix='', - primary_key=True, - serialize=False, - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0013_alter_quib_id_alter_quiblet_id.py b/backend/apps/quiblet/migrations/0013_alter_quib_id_alter_quiblet_id.py deleted file mode 100644 index 2bb189d8..00000000 --- a/backend/apps/quiblet/migrations/0013_alter_quib_id_alter_quiblet_id.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 15:48 - -import shortuuid.django_fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0012_alter_quib_id_alter_quiblet_id'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - length=6, - max_length=6, - prefix='', - primary_key=True, - serialize=False, - ), - ), - migrations.AlterField( - model_name='quiblet', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - length=6, - max_length=6, - prefix='', - primary_key=True, - serialize=False, - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0014_alter_quib_id_alter_quiblet_id.py b/backend/apps/quiblet/migrations/0014_alter_quib_id_alter_quiblet_id.py deleted file mode 100644 index 51463d97..00000000 --- a/backend/apps/quiblet/migrations/0014_alter_quib_id_alter_quiblet_id.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 15:49 - -import shortuuid.django_fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0013_alter_quib_id_alter_quiblet_id'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - length=7, - max_length=7, - prefix='', - primary_key=True, - serialize=False, - ), - ), - migrations.AlterField( - model_name='quiblet', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - length=7, - max_length=7, - prefix='', - primary_key=True, - serialize=False, - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0015_alter_quib_slug.py b/backend/apps/quiblet/migrations/0015_alter_quib_slug.py deleted file mode 100644 index 0ef7a2f7..00000000 --- a/backend/apps/quiblet/migrations/0015_alter_quib_slug.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 16:00 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0014_alter_quib_id_alter_quiblet_id'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='slug', - field=models.SlugField(max_length=25, verbose_name='slug'), - ), - ] diff --git a/backend/apps/quiblet/migrations/0016_alter_quib_id_alter_quib_slug_alter_quiblet_id.py b/backend/apps/quiblet/migrations/0016_alter_quib_id_alter_quib_slug_alter_quiblet_id.py deleted file mode 100644 index 83962137..00000000 --- a/backend/apps/quiblet/migrations/0016_alter_quib_id_alter_quib_slug_alter_quiblet_id.py +++ /dev/null @@ -1,47 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 16:03 - -import shortuuid.django_fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0015_alter_quib_slug'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - length=7, - max_length=7, - prefix='', - primary_key=True, - serialize=False, - verbose_name='id', - ), - ), - migrations.AlterField( - model_name='quib', - name='slug', - field=models.SlugField( - blank=True, editable=False, max_length=25, verbose_name='slug' - ), - ), - migrations.AlterField( - model_name='quiblet', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - length=7, - max_length=7, - prefix='', - primary_key=True, - serialize=False, - verbose_name='id', - ), - ), - ] diff --git a/backend/apps/quiblet/migrations/0017_alter_quib_id_alter_quiblet_id.py b/backend/apps/quiblet/migrations/0017_alter_quib_id_alter_quiblet_id.py deleted file mode 100644 index ad2ed6ce..00000000 --- a/backend/apps/quiblet/migrations/0017_alter_quib_id_alter_quiblet_id.py +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-04 16:11 - -import shortuuid.django_fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0016_alter_quib_id_alter_quib_slug_alter_quiblet_id'), - ] - - operations = [ - migrations.AlterField( - model_name='quib', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - editable=False, - length=7, - max_length=7, - prefix='', - primary_key=True, - serialize=False, - verbose_name='id', - ), - ), - migrations.AlterField( - model_name='quiblet', - name='id', - field=shortuuid.django_fields.ShortUUIDField( - alphabet='abcdefghijklmnopqrstuvwxyz0123456789', - editable=False, - length=7, - max_length=7, - prefix='', - primary_key=True, - serialize=False, - verbose_name='id', - ), - ), - ] 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 deleted file mode 100644 index d8d399d9..00000000 --- a/backend/apps/quiblet/migrations/0018_alter_quib_quibber_alter_quib_quiblet.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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/migrations/0019_alter_quib_options.py b/backend/apps/quiblet/migrations/0019_alter_quib_options.py deleted file mode 100644 index 31b1e3d7..00000000 --- a/backend/apps/quiblet/migrations/0019_alter_quib_options.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-06 11:13 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('quiblet', '0018_alter_quib_quibber_alter_quib_quiblet'), - ] - - operations = [ - migrations.AlterModelOptions( - name='quib', - options={ - 'ordering': ['-created_at'], - 'verbose_name': 'Quib', - 'verbose_name_plural': 'Quibs', - }, - ), - ] diff --git a/backend/apps/quiblet/models.py b/backend/apps/quiblet/models.py index 31f54283..37b25626 100644 --- a/backend/apps/quiblet/models.py +++ b/backend/apps/quiblet/models.py @@ -6,12 +6,7 @@ from dynamic_filenames import FilePattern from apps.user.models import Profile -from shared.mixins.model_mixins import ( - AvatarMixin, - CreatedAtMixin, - IsPublicMixin, - ShortUUIDIdMixin, -) +from common.mixins import AvatarMixin, CreatedAtMixin, IsPublicMixin, ShortUUIDIdMixin class Quiblet(AvatarMixin, CreatedAtMixin, IsPublicMixin, ShortUUIDIdMixin): diff --git a/backend/apps/user/api/serializers.py b/backend/apps/user/api/serializers.py index a904d969..feb6a2e3 100644 --- a/backend/apps/user/api/serializers.py +++ b/backend/apps/user/api/serializers.py @@ -11,7 +11,7 @@ class Meta: extra_kwargs = {'password': {'write_only': True}} def create(self, validated_data): - user = User.objects.create_user(**validated_data) + user = User.objects.create_user(**validated_data) # type: ignore return user diff --git a/backend/apps/user/api/views.py b/backend/apps/user/api/views.py index 58cf3078..c2112106 100644 --- a/backend/apps/user/api/views.py +++ b/backend/apps/user/api/views.py @@ -4,8 +4,8 @@ from rest_framework.authtoken.models import Token from rest_framework.response import Response -from shared.exceptions import ServerError -from shared.serializers import DetailResponseSerializer +from common.exceptions import ServerError +from common.serializers import DetailResponseSerializer from .serializers import AuthSerializer, AuthTokenResponseSerializer, ProfileSerializer diff --git a/backend/apps/user/migrations/0001_initial.py b/backend/apps/user/migrations/0001_initial.py index 0187c5d3..243e656d 100644 --- a/backend/apps/user/migrations/0001_initial.py +++ b/backend/apps/user/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.3 on 2024-12-01 16:35 +# Generated by Django 5.1.3 on 2024-12-06 15:53 import functools @@ -8,7 +8,7 @@ from django.db import migrations, models import apps.user.managers -import shared.mixins.model_mixins +import common.mixins class Migration(migrations.Migration): @@ -95,7 +95,9 @@ class Migration(migrations.Migration): ), ], options={ - 'abstract': False, + 'verbose_name': 'User', + 'verbose_name_plural': 'Users', + 'ordering': ['-date_joined'], }, managers=[ ('objects', apps.user.managers.CustomUserManager()), @@ -131,7 +133,7 @@ class Migration(migrations.Migration): ('error', 'error'), ], default=functools.partial( - shared.mixins.model_mixins.get_random_color, + common.mixins.get_random_color, *( [ ('primary', 'primary'), @@ -187,7 +189,9 @@ class Migration(migrations.Migration): ), ], options={ - 'abstract': False, + 'verbose_name': 'Profile', + 'verbose_name_plural': 'Profiles', + 'ordering': ['-created_at'], }, ), ] diff --git a/backend/apps/user/migrations/0002_alter_profile_options_alter_user_options.py b/backend/apps/user/migrations/0002_alter_profile_options_alter_user_options.py deleted file mode 100644 index 3557e3ab..00000000 --- a/backend/apps/user/migrations/0002_alter_profile_options_alter_user_options.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-06 11:12 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0001_initial'), - ] - - operations = [ - migrations.AlterModelOptions( - name='profile', - options={ - 'ordering': ['-created_at'], - 'verbose_name': 'Profile', - 'verbose_name_plural': 'Profiles', - }, - ), - migrations.AlterModelOptions( - name='user', - options={ - 'ordering': ['-date_joined'], - 'verbose_name': 'User', - 'verbose_name_plural': 'Users', - }, - ), - ] diff --git a/backend/apps/user/models.py b/backend/apps/user/models.py index 743653e5..5969df51 100644 --- a/backend/apps/user/models.py +++ b/backend/apps/user/models.py @@ -2,7 +2,7 @@ from django.db import models from django.utils.translation import gettext_lazy as _ -from shared.mixins.model_mixins import AvatarMixin, ColorMixin, CreatedAtMixin +from common.mixins import AvatarMixin, ColorMixin, CreatedAtMixin from .managers import CustomUserManager diff --git a/backend/core/__init__.py b/backend/common/__init__.py similarity index 100% rename from backend/core/__init__.py rename to backend/common/__init__.py diff --git a/backend/shared/exceptions.py b/backend/common/exceptions.py similarity index 100% rename from backend/shared/exceptions.py rename to backend/common/exceptions.py diff --git a/backend/shared/mixins/model_mixins.py b/backend/common/mixins.py similarity index 100% rename from backend/shared/mixins/model_mixins.py rename to backend/common/mixins.py diff --git a/backend/shared/permissions.py b/backend/common/permissions.py similarity index 100% rename from backend/shared/permissions.py rename to backend/common/permissions.py diff --git a/backend/shared/serializers.py b/backend/common/serializers.py similarity index 100% rename from backend/shared/serializers.py rename to backend/common/serializers.py diff --git a/backend/shared/__init__.py b/backend/config/__init__.py similarity index 100% rename from backend/shared/__init__.py rename to backend/config/__init__.py diff --git a/backend/core/asgi.py b/backend/config/asgi.py similarity index 59% rename from backend/core/asgi.py rename to backend/config/asgi.py index d739b7ed..a00b3b55 100644 --- a/backend/core/asgi.py +++ b/backend/config/asgi.py @@ -2,6 +2,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') application = get_asgi_application() diff --git a/backend/core/settings.py b/backend/config/settings.py similarity index 97% rename from backend/core/settings.py rename to backend/config/settings.py index 952ca7c1..8749a1d3 100644 --- a/backend/core/settings.py +++ b/backend/config/settings.py @@ -75,8 +75,8 @@ } # https://drf-standardized-errors.readthedocs.io/en/latest/openapi.html#hide-error-responses-that-show-in-every-operation -with open(BASE_DIR / 'docs' / 'openapi_description.md') as f: - openapi_description = f.read() +with open(BASE_DIR / 'docs' / 'openapi_desc.md') as md_file: + openapi_description = md_file.read() SPECTACULAR_SETTINGS = { 'TITLE': 'QuibbleAPI', @@ -124,7 +124,7 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -ROOT_URLCONF = 'core.urls' +ROOT_URLCONF = 'config.urls' TEMPLATES = [ { @@ -142,7 +142,7 @@ }, ] -WSGI_APPLICATION = 'core.wsgi.application' +WSGI_APPLICATION = 'config.wsgi.application' # Database diff --git a/backend/core/urls.py b/backend/config/urls.py similarity index 100% rename from backend/core/urls.py rename to backend/config/urls.py diff --git a/backend/core/wsgi.py b/backend/config/wsgi.py similarity index 59% rename from backend/core/wsgi.py rename to backend/config/wsgi.py index f7ff4d68..a9f185cf 100644 --- a/backend/core/wsgi.py +++ b/backend/config/wsgi.py @@ -2,6 +2,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') application = get_wsgi_application() diff --git a/backend/shared/mixins/__init__.py b/backend/deployments/.gitkeep similarity index 100% rename from backend/shared/mixins/__init__.py rename to backend/deployments/.gitkeep diff --git a/backend/docs/openapi_description.md b/backend/docs/openapi_desc.md similarity index 100% rename from backend/docs/openapi_description.md rename to backend/docs/openapi_desc.md diff --git a/backend/manage.py b/backend/manage.py index f2a662cf..8e7ac79b 100755 --- a/backend/manage.py +++ b/backend/manage.py @@ -6,7 +6,7 @@ def main(): """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/backend/pyproject.toml b/backend/pyproject.toml index a4befb75..cdcaeb74 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -78,7 +78,7 @@ format = ["isort", "black"] lint = "flake8" [tool.pytest.ini_options] -DJANGO_SETTINGS_MODULE = "core.settings" +DJANGO_SETTINGS_MODULE = "config.settings" pythonpath = ["."] python_files = ["test_*.py"] diff --git a/backend/static/.gitkeep b/backend/static/.gitkeep new file mode 100644 index 00000000..e69de29b