summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/models.py11
-rw-r--r--mirrors/models.py4
-rw-r--r--news/models.py3
3 files changed, 11 insertions, 7 deletions
diff --git a/main/models.py b/main/models.py
index 3812013..772d85b 100644
--- a/main/models.py
+++ b/main/models.py
@@ -104,8 +104,10 @@ class Repo(models.Model):
verbose_name_plural = 'repos'
class Package(models.Model):
- repo = models.ForeignKey(Repo, related_name="packages")
- arch = models.ForeignKey(Arch, related_name="packages")
+ repo = models.ForeignKey(Repo, related_name="packages",
+ on_delete=models.PROTECT)
+ arch = models.ForeignKey(Arch, related_name="packages",
+ on_delete=models.PROTECT)
pkgname = models.CharField(max_length=255, db_index=True)
pkgbase = models.CharField(max_length=255, db_index=True)
pkgver = models.CharField(max_length=255)
@@ -121,7 +123,8 @@ class Package(models.Model):
last_update = models.DateTimeField(null=True, blank=True)
files_last_update = models.DateTimeField(null=True, blank=True)
packager_str = models.CharField(max_length=255)
- packager = models.ForeignKey(User, null=True)
+ packager = models.ForeignKey(User, null=True,
+ on_delete=models.SET_NULL)
flag_date = models.DateTimeField(null=True)
objects = PackageManager()
@@ -348,7 +351,7 @@ class PackageDepend(models.Model):
db_table = 'package_depends'
class Todolist(models.Model):
- creator = models.ForeignKey(User)
+ creator = models.ForeignKey(User, on_delete=models.PROTECT)
name = models.CharField(max_length=255)
description = models.TextField()
date_added = models.DateTimeField(db_index=True)
diff --git a/mirrors/models.py b/mirrors/models.py
index dce17b5..80808e2 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -14,7 +14,7 @@ TIER_CHOICES = (
class Mirror(models.Model):
name = models.CharField(max_length=255, unique=True)
tier = models.SmallIntegerField(default=2, choices=TIER_CHOICES)
- upstream = models.ForeignKey('self', null=True)
+ upstream = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
country = models.CharField(max_length=255, db_index=True)
admin_email = models.EmailField(max_length=255, blank=True)
public = models.BooleanField(default=True)
@@ -56,7 +56,7 @@ class MirrorProtocol(models.Model):
class MirrorUrl(models.Model):
url = models.CharField(max_length=255, unique=True)
protocol = models.ForeignKey(MirrorProtocol, related_name="urls",
- editable=False)
+ editable=False, on_delete=models.PROTECT)
mirror = models.ForeignKey(Mirror, related_name="urls")
has_ipv4 = models.BooleanField("IPv4 capable", default=True,
editable=False)
diff --git a/news/models.py b/news/models.py
index 5e46751..33d958e 100644
--- a/news/models.py
+++ b/news/models.py
@@ -6,7 +6,8 @@ from django.contrib.sites.models import Site
class News(models.Model):
slug = models.SlugField(max_length=255, unique=True)
- author = models.ForeignKey(User, related_name='news_author')
+ author = models.ForeignKey(User, related_name='news_author',
+ on_delete=models.PROTECT)
postdate = models.DateTimeField("post date", db_index=True)
last_modified = models.DateTimeField(editable=False, db_index=True)
title = models.CharField(max_length=255)