mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField
This commit is contained in:
committed by
Tim Graham
parent
87d55081ea
commit
c2e70f0265
@@ -11,18 +11,18 @@ class SystemDetails(models.Model):
|
||||
|
||||
|
||||
class SystemInfo(models.Model):
|
||||
system_details = models.ForeignKey(SystemDetails)
|
||||
system_details = models.ForeignKey(SystemDetails, models.CASCADE)
|
||||
system_name = models.CharField(max_length=32)
|
||||
|
||||
|
||||
class Forum(models.Model):
|
||||
system_info = models.ForeignKey(SystemInfo)
|
||||
system_info = models.ForeignKey(SystemInfo, models.CASCADE)
|
||||
forum_name = models.CharField(max_length=32)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Post(models.Model):
|
||||
forum = models.ForeignKey(Forum, null=True)
|
||||
forum = models.ForeignKey(Forum, models.SET_NULL, null=True)
|
||||
title = models.CharField(max_length=32)
|
||||
|
||||
def __str__(self):
|
||||
@@ -31,7 +31,7 @@ class Post(models.Model):
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Comment(models.Model):
|
||||
post = models.ForeignKey(Post, null=True)
|
||||
post = models.ForeignKey(Post, models.SET_NULL, null=True)
|
||||
comment_text = models.CharField(max_length=250)
|
||||
|
||||
class Meta:
|
||||
@@ -52,6 +52,6 @@ class PropertyValue(models.Model):
|
||||
|
||||
|
||||
class Property(models.Model):
|
||||
item = models.ForeignKey(Item, related_name='props')
|
||||
item = models.ForeignKey(Item, models.CASCADE, related_name='props')
|
||||
key = models.CharField(max_length=100)
|
||||
value = models.ForeignKey(PropertyValue, null=True)
|
||||
value = models.ForeignKey(PropertyValue, models.SET_NULL, null=True)
|
||||
|
||||
Reference in New Issue
Block a user