2008-06-08 20:13:46 +02:00
|
|
|
"""
|
2008-07-27 03:18:23 +02:00
|
|
|
Regression tests for proper working of ForeignKey(null=True).
|
2008-06-08 20:13:46 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
2011-10-13 23:34:56 +02:00
|
|
|
|
2010-03-08 13:47:16 +01:00
|
|
|
class SystemDetails(models.Model):
|
|
|
|
details = models.TextField()
|
|
|
|
|
2013-11-02 22:34:05 +01:00
|
|
|
|
2008-06-08 20:13:46 +02:00
|
|
|
class SystemInfo(models.Model):
|
2015-07-22 16:43:21 +02:00
|
|
|
system_details = models.ForeignKey(SystemDetails, models.CASCADE)
|
2008-06-08 20:13:46 +02:00
|
|
|
system_name = models.CharField(max_length=32)
|
|
|
|
|
2013-11-02 22:34:05 +01:00
|
|
|
|
2008-06-08 20:13:46 +02:00
|
|
|
class Forum(models.Model):
|
2015-07-22 16:43:21 +02:00
|
|
|
system_info = models.ForeignKey(SystemInfo, models.CASCADE)
|
2008-06-08 20:13:46 +02:00
|
|
|
forum_name = models.CharField(max_length=32)
|
|
|
|
|
2013-11-02 22:34:05 +01:00
|
|
|
|
2008-06-08 20:13:46 +02:00
|
|
|
class Post(models.Model):
|
2015-07-22 16:43:21 +02:00
|
|
|
forum = models.ForeignKey(Forum, models.SET_NULL, null=True)
|
2008-06-08 20:13:46 +02:00
|
|
|
title = models.CharField(max_length=32)
|
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
def __str__(self):
|
2008-06-08 20:13:46 +02:00
|
|
|
return self.title
|
|
|
|
|
2013-11-02 22:34:05 +01:00
|
|
|
|
2008-06-08 20:13:46 +02:00
|
|
|
class Comment(models.Model):
|
2015-07-22 16:43:21 +02:00
|
|
|
post = models.ForeignKey(Post, models.SET_NULL, null=True)
|
2008-06-08 20:13:46 +02:00
|
|
|
comment_text = models.CharField(max_length=250)
|
|
|
|
|
2009-06-29 14:29:48 +02:00
|
|
|
class Meta:
|
|
|
|
ordering = ("comment_text",)
|
2022-02-03 20:24:19 +01:00
|
|
|
|
2009-06-29 14:29:48 +02:00
|
|
|
|
2011-05-05 22:26:26 +02:00
|
|
|
# Ticket 15823
|
|
|
|
|
2013-11-02 22:34:05 +01:00
|
|
|
|
2011-05-05 22:26:26 +02:00
|
|
|
class Item(models.Model):
|
|
|
|
title = models.CharField(max_length=100)
|
|
|
|
|
2013-11-02 22:34:05 +01:00
|
|
|
|
2011-05-05 22:26:26 +02:00
|
|
|
class PropertyValue(models.Model):
|
|
|
|
label = models.CharField(max_length=100)
|
|
|
|
|
2013-11-02 22:34:05 +01:00
|
|
|
|
2011-05-05 22:26:26 +02:00
|
|
|
class Property(models.Model):
|
2015-07-22 16:43:21 +02:00
|
|
|
item = models.ForeignKey(Item, models.CASCADE, related_name="props")
|
2011-05-05 22:26:26 +02:00
|
|
|
key = models.CharField(max_length=100)
|
2015-07-22 16:43:21 +02:00
|
|
|
value = models.ForeignKey(PropertyValue, models.SET_NULL, null=True)
|