Set a user FK to null when the user gets deleted

Otherwise we might forget to delete them on the related systems.
This commit is contained in:
Andreas Zweili 2023-03-11 18:16:21 +01:00
parent 48ec5b7ee4
commit 7f15b4b934
1 changed files with 1 additions and 1 deletions

View File

@ -12,7 +12,7 @@ class Login(models.Model):
email = models.CharField(max_length=50, blank=True)
enabled = models.BooleanField()
description = models.TextField(blank=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.SET_NULL)
service = models.ForeignKey(
Service, on_delete=models.SET_NULL, blank=True, null=True
)