diff --git a/docker-compose.yml b/docker-compose.yml index a5f43511a64091ea7c7a8bd9f6921115474698d6..39178934d0d714e3b7169b4a876361253b9df3c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: main: build: . container_name: main - command: bash -c "python main/manage.py makemigrations && python main/manage.py migrate && python main/manage.py runserver 0.0.0.0:8000" + command: bash -c "python main/manage.py makemigrations contact && python main/manage.py migrate contact && python main/manage.py runserver 0.0.0.0:8000" volumes: - .:/usr/src/app ports: @@ -22,7 +22,7 @@ services: posts: build: . container_name: posts - command: bash -c "python post/manage.py makemigrations && python post/manage.py migrate && python post/manage.py runserver 0.0.0.0:8002" + command: bash -c "python post/manage.py makemigrations postapp && python post/manage.py migrate postapp && python post/manage.py runserver 0.0.0.0:8002" volumes: - .:/usr/src/app ports: @@ -32,7 +32,7 @@ services: profiles: build: . container_name: profiles - command: bash -c "python profiles/manage.py makemigrations && python profiles/manage.py migrate && python profiles/manage.py runserver 0.0.0.0:8003" + command: bash -c "python profiles/manage.py makemigrations profileapp && python profiles/manage.py migrate profileapp && python profiles/manage.py runserver 0.0.0.0:8003" volumes: - .:/usr/src/app ports: diff --git a/post/postapp/__pycache__/models.cpython-312.pyc b/post/postapp/__pycache__/models.cpython-312.pyc index b3b0be386a52a1398d3ee4aca6ecbffeb8c09e11..51a720ee18be893acf95c9c6999c182cd6fccf30 100644 Binary files a/post/postapp/__pycache__/models.cpython-312.pyc and b/post/postapp/__pycache__/models.cpython-312.pyc differ diff --git a/post/postapp/migrations/0002_alter_post_author.py b/post/postapp/migrations/0002_alter_post_author.py new file mode 100644 index 0000000000000000000000000000000000000000..628099731e9ed9ed239bd2f3538934eb540f0e75 --- /dev/null +++ b/post/postapp/migrations/0002_alter_post_author.py @@ -0,0 +1,21 @@ +# Generated by Django 3.2.25 on 2024-04-30 11:56 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('postapp', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='post', + name='author', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/post/postapp/migrations/__pycache__/0002_alter_post_author.cpython-312.pyc b/post/postapp/migrations/__pycache__/0002_alter_post_author.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9933760febd76b396f139e7f0341f8bc0f5d60e7 Binary files /dev/null and b/post/postapp/migrations/__pycache__/0002_alter_post_author.cpython-312.pyc differ diff --git a/post/postapp/models.py b/post/postapp/models.py index dba99f4af36b903a6006f0b84ade53bc097d74c0..aa61962e845f51744248b1dadcf0bfe3f1b3fa22 100644 --- a/post/postapp/models.py +++ b/post/postapp/models.py @@ -7,7 +7,7 @@ alphanumeric = RegexValidator(r'^[0-9a-zA-Z]*$', '') #Just in case class post(models.Model): #login profile - author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null =True, blank = True) #Needs improvement, compare to others + author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True) #Needs improvement, compare to others description = models.TextField() created_at = models.DateTimeField(auto_now = True) #Simple enough updated_at = models.DateTimeField(auto_now=True) diff --git a/profiles/profileapp/__pycache__/models.cpython-312.pyc b/profiles/profileapp/__pycache__/models.cpython-312.pyc index 41a804132f9af6db93c383808b0b7895b99f8b4d..50e21fa9f74055cde921399edb3781277f79fda4 100644 Binary files a/profiles/profileapp/__pycache__/models.cpython-312.pyc and b/profiles/profileapp/__pycache__/models.cpython-312.pyc differ diff --git a/profiles/profileapp/migrations/0002_alter_profile_user.py b/profiles/profileapp/migrations/0002_alter_profile_user.py new file mode 100644 index 0000000000000000000000000000000000000000..443bfb7f7a2caf27230f3377182820911abeb681 --- /dev/null +++ b/profiles/profileapp/migrations/0002_alter_profile_user.py @@ -0,0 +1,21 @@ +# Generated by Django 3.2.25 on 2024-04-30 11:56 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('profileapp', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='user', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/profiles/profileapp/migrations/__pycache__/0002_alter_profile_user.cpython-312.pyc b/profiles/profileapp/migrations/__pycache__/0002_alter_profile_user.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e13b393d8545a72731544a234e997cf8ebe70cb1 Binary files /dev/null and b/profiles/profileapp/migrations/__pycache__/0002_alter_profile_user.cpython-312.pyc differ diff --git a/profiles/profileapp/models.py b/profiles/profileapp/models.py index 117dd850cdaaa958a11744960983f1c1c9dc3e3d..652dff30fcae6eea4a1d07f1647a7b73e1ed0da0 100644 --- a/profiles/profileapp/models.py +++ b/profiles/profileapp/models.py @@ -3,7 +3,7 @@ from django.db import models from django.conf import settings class Profile(models.Model): - user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True) bio = models.TextField(blank=True) profile_picture = models.ImageField(upload_to='profile_pics/', blank=True)