Skip to content

Commit

Permalink
mark Favourite to be deleted when related user is deleted
Browse files Browse the repository at this point in the history
favourite does not seem like a model that needs to be kept around after user deletion
  • Loading branch information
henrinie-nc authored and NC-jsAhonen committed Nov 21, 2024
1 parent f0ca837 commit bf0f4ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions plotsearch/migrations/0038_alter_favourite_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.16 on 2024-11-20 11:55

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),
("plotsearch", "0037_alter_areasearchattachment_options_and_more"),
]

operations = [
migrations.AlterField(
model_name="favourite",
name="user",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
]
2 changes: 1 addition & 1 deletion plotsearch/models/plot_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class MeetingMemo(models.Model):


class Favourite(models.Model):
user = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
user = models.ForeignKey(User, null=True, on_delete=models.CASCADE)

created_at = models.DateTimeField(auto_now_add=True, db_index=True)
modified_at = models.DateTimeField(auto_now=True)
Expand Down

0 comments on commit bf0f4ec

Please sign in to comment.