From cbe68eb58a5acf5caf0ad919930cf74113206c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Thu, 31 Aug 2023 15:39:14 +0200 Subject: [PATCH] add blank for optional sender_user --- .../migrations/0008_conversation_sender_user.py | 4 ++-- lemarche/conversations/models.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lemarche/conversations/migrations/0008_conversation_sender_user.py b/lemarche/conversations/migrations/0008_conversation_sender_user.py index 975673e19..512742535 100644 --- a/lemarche/conversations/migrations/0008_conversation_sender_user.py +++ b/lemarche/conversations/migrations/0008_conversation_sender_user.py @@ -1,12 +1,11 @@ # Generated by Django 4.2.2 on 2023-08-30 12:36 +import django.db.models.deletion 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), ("conversations", "0007_conversation_sender_first_name_and_more"), @@ -18,6 +17,7 @@ class Migration(migrations.Migration): name="sender_user", field=models.ForeignKey( null=True, + blank=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name="Utilisateur à l'initiative", diff --git a/lemarche/conversations/models.py b/lemarche/conversations/models.py index cc2c18d55..cb900555c 100644 --- a/lemarche/conversations/models.py +++ b/lemarche/conversations/models.py @@ -40,7 +40,11 @@ class Conversation(models.Model): verbose_name="Type de conversation", default=KIND_SEARCH, choices=KIND_CHOICES, max_length=10, db_index=True ) sender_user = models.ForeignKey( - settings.AUTH_USER_MODEL, verbose_name="Utilisateur à l'initiative", on_delete=models.CASCADE, null=True + settings.AUTH_USER_MODEL, + verbose_name="Utilisateur à l'initiative", + on_delete=models.CASCADE, + null=True, + blank=True, ) sender_email = models.EmailField(verbose_name="Email de l'initiateur de la conversation", null=True) sender_first_name = models.CharField(verbose_name="Prénom", max_length=150)