Commit 5913a469 authored by hypsug0's avatar hypsug0
Browse files

fix: set main_observer to null on user delete

parent 054067b9
......@@ -12,7 +12,7 @@ from django.core.files.storage import FileSystemStorage
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.db.models import Sum
from django.db.models.deletion import DO_NOTHING
from django.db.models.deletion import DO_NOTHING, SET_NULL
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from django.urls import reverse
......@@ -860,7 +860,7 @@ class Session(models.Model):
),
)
main_observer = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=DO_NOTHING, related_name="mainobs"
settings.AUTH_USER_MODEL, on_delete=SET_NULL, related_name="mainobs", null=True
)
other_observer = models.ManyToManyField(
settings.AUTH_USER_MODEL, blank=True, related_name="otherobs"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment