2010-01-10 11:36:59 +08:00
|
|
|
from django.db import models
|
|
|
|
|
2011-10-14 02:51:33 +08:00
|
|
|
|
2010-01-10 11:36:59 +08:00
|
|
|
class Article(models.Model):
|
|
|
|
"""
|
|
|
|
A simple Article model for testing
|
|
|
|
"""
|
2010-02-01 22:12:56 +08:00
|
|
|
site = models.ForeignKey('sites.Site', related_name="admin_articles")
|
2010-01-10 11:36:59 +08:00
|
|
|
title = models.CharField(max_length=100)
|
|
|
|
title2 = models.CharField(max_length=100, verbose_name="another name")
|
|
|
|
created = models.DateTimeField()
|
|
|
|
|
|
|
|
def test_from_model(self):
|
|
|
|
return "nothing"
|
|
|
|
|
|
|
|
def test_from_model_with_override(self):
|
|
|
|
return "nothing"
|
2010-04-11 16:35:04 +08:00
|
|
|
test_from_model_with_override.short_description = "not What you Expect"
|
2010-02-26 21:17:43 +08:00
|
|
|
|
|
|
|
class Count(models.Model):
|
|
|
|
num = models.PositiveSmallIntegerField()
|
2010-11-10 00:46:42 +08:00
|
|
|
parent = models.ForeignKey('self', null=True)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return unicode(self.num)
|
2010-10-17 23:17:52 +08:00
|
|
|
|
|
|
|
class Event(models.Model):
|
|
|
|
date = models.DateTimeField(auto_now_add=True)
|
|
|
|
|
|
|
|
class Location(models.Model):
|
|
|
|
event = models.OneToOneField(Event, verbose_name='awesome event')
|
|
|
|
|
|
|
|
class Guest(models.Model):
|
|
|
|
event = models.OneToOneField(Event)
|
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
verbose_name = "awesome guest"
|