2009-04-08 18:53:55 +00:00
|
|
|
import os
|
2008-10-08 10:09:44 +00:00
|
|
|
from django.db import models
|
2009-04-18 15:51:11 +00:00
|
|
|
|
|
|
|
class Person(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
2008-10-08 10:09:44 +00:00
|
|
|
|
|
|
|
class Triple(models.Model):
|
|
|
|
left = models.IntegerField()
|
|
|
|
middle = models.IntegerField()
|
|
|
|
right = models.IntegerField()
|
|
|
|
|
|
|
|
class Meta:
|
2009-04-11 07:41:59 +00:00
|
|
|
unique_together = (('left', 'middle'), (u'middle', u'right'))
|
2008-10-08 10:09:44 +00:00
|
|
|
|
2009-04-08 18:53:55 +00:00
|
|
|
class FilePathModel(models.Model):
|
|
|
|
path = models.FilePathField(path=os.path.dirname(__file__), match=".*\.py$", blank=True)
|
2009-05-02 07:03:33 +00: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
|