2009-04-09 02:53:55 +08:00
|
|
|
import os
|
2008-10-08 18:09:44 +08:00
|
|
|
from django.db import models
|
2009-04-18 23:51:11 +08:00
|
|
|
|
|
|
|
class Person(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
2008-10-08 18:09:44 +08:00
|
|
|
|
|
|
|
class Triple(models.Model):
|
|
|
|
left = models.IntegerField()
|
|
|
|
middle = models.IntegerField()
|
|
|
|
right = models.IntegerField()
|
|
|
|
|
|
|
|
class Meta:
|
2009-04-11 15:41:59 +08:00
|
|
|
unique_together = (('left', 'middle'), (u'middle', u'right'))
|
2008-10-08 18:09:44 +08:00
|
|
|
|
2009-04-09 02:53:55 +08:00
|
|
|
class FilePathModel(models.Model):
|
|
|
|
path = models.FilePathField(path=os.path.dirname(__file__), match=".*\.py$", blank=True)
|
2009-05-02 15:03:33 +08:00
|
|
|
|
|
|
|
class Publication(models.Model):
|
|
|
|
title = models.CharField(max_length=30)
|
|
|
|
date = models.DateField()
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
|
|
|
|
|
|
|
class Article(models.Model):
|
|
|
|
headline = models.CharField(max_length=100)
|
|
|
|
publications = models.ManyToManyField(Publication)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.headline
|