2013-03-20 18:47:56 +08:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
|
|
class Category(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
def next(self):
|
|
|
|
return self
|
|
|
|
|
|
|
|
|
|
|
|
class Thing(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
2015-07-22 22:43:21 +08:00
|
|
|
category = models.ForeignKey(Category, models.CASCADE)
|
2015-09-12 14:06:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
class CategoryInfo(models.Model):
|
|
|
|
category = models.OneToOneField(Category, models.CASCADE)
|