Commit cb8d42b5 authored by gijs's avatar gijs

Finetuned on_delete settings

parent 34945270
......@@ -41,7 +41,7 @@ class Venue(models.Model):
class Image(models.Model):
published = models.BooleanField(default=False)
oldImage = models.ImageField(upload_to="images", null=True, blank=True)
image = FilerImageField(null=True, blank=True, on_delete=models.PROTECT)
image = FilerImageField(null=True, blank=True, on_delete=models.CASCADE)
title_nl = models.CharField(max_length=255)
tagline_nl = models.CharField(max_length=255, null=True, blank=True)
title_en = models.CharField(max_length=255, verbose_name="Title (English)", null=True, blank=True)
......@@ -153,8 +153,8 @@ class Event(models.Model):
published = models.BooleanField(default=True)
continuous = models.BooleanField(default=False)
project = models.ForeignKey(Project, on_delete=models.CASCADE)
event_type = models.ForeignKey(EventType, on_delete=models.PROTECT)
venue = models.ForeignKey(Venue, on_delete=models.PROTECT)
event_type = models.ForeignKey(EventType, on_delete=models.SET_NULL, null=True)
venue = models.ForeignKey(Venue, on_delete=models.SET_NULL, null=True)
notes_nl = models.TextField(null=True, blank=True)
notes_en = models.TextField(verbose_name="Notes (English)", null=True, blank=True)
start = models.DateTimeField()
......@@ -216,8 +216,8 @@ class ProjectParticipant(models.Model):
def __str__ (self):
return self.participant.__str__()
participant = models.ForeignKey(Participant, on_delete=models.PROTECT)
project = SortableForeignKey(Project, on_delete=models.PROTECT)
participant = models.ForeignKey(Participant, on_delete=models.CASCADE)
project = SortableForeignKey(Project, on_delete=models.CASCADE)
role_nl = models.CharField(max_length=255)
role_en = models.CharField(max_length=255, verbose_name="Role (English)")
position = models.PositiveIntegerField(default=0, editable=True, db_index=True)
......@@ -243,8 +243,8 @@ class ProjectImage(models.Model):
class Meta:
ordering = ('position',)
project = SortableForeignKey(Project, on_delete=models.PROTECT)
image = models.ForeignKey(Image, on_delete=models.PROTECT)
project = SortableForeignKey(Project, on_delete=models.CASCADE)
image = models.ForeignKey(Image, on_delete=models.CASCADE)
position = models.PositiveIntegerField(default=0, editable=True, db_index=True)
cover_image = models.BooleanField(default=True)
......@@ -253,8 +253,8 @@ class ProjectImage(models.Model):
class ProjectPad(models.Model):
project = models.ForeignKey(Project, on_delete=models.PROTECT)
pad = models.ForeignKey(Pad, on_delete=models.PROTECT)
project = models.ForeignKey(Project, on_delete=models.CASCADE)
pad = models.ForeignKey(Pad, on_delete=models.CASCADE)
position = models.PositiveIntegerField(default=0, editable=True, db_index=True)
def __getattr__ (self, attrname):
......@@ -281,7 +281,7 @@ class Page(models.Model):
title_en = models.CharField(max_length=255, verbose_name="Title (English)", null=True, blank=True)
summary_en = models.TextField(null=True, blank=True, verbose_name="Summary (English) shown on parent page")
content_en = models.TextField(verbose_name="Content (English)", null=True, blank=True)
parent = models.ForeignKey('Page', on_delete=models.CASCADE, related_name='subpage', null=True, blank=True)
parent = models.ForeignKey('Page', on_delete=models.SET_NULL, related_name='subpage', null=True, blank=True)
def __str__ (self):
return '{}'.format(self.title)
......@@ -318,7 +318,7 @@ class Loop(models.Model):
published = models.BooleanField(default=False)
description_nl = models.TextField(verbose_name="Description (Dutch)", null=True, blank=True)
description_en = models.TextField(verbose_name="Description (English)", null=True, blank=True)
page = models.ForeignKey(Page, on_delete=models.CASCADE, related_name='loop', null=True, blank=True)
page = models.ForeignKey(Page, on_delete=models.SET_NULL, related_name='loop', null=True, blank=True)
def __str__ (self):
return '{}'.format(self.name)
......
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