mirror of
https://github.com/django/django.git
synced 2024-11-18 23:44:22 +00:00
fbf5eaac94
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10652 bcc190cf-cafb-0310-a4f2-bffc1f526a37
31 lines
811 B
Python
31 lines
811 B
Python
import os
|
|
from django.db import models
|
|
|
|
class Person(models.Model):
|
|
name = models.CharField(max_length=100)
|
|
|
|
class Triple(models.Model):
|
|
left = models.IntegerField()
|
|
middle = models.IntegerField()
|
|
right = models.IntegerField()
|
|
|
|
class Meta:
|
|
unique_together = (('left', 'middle'), (u'middle', u'right'))
|
|
|
|
class FilePathModel(models.Model):
|
|
path = models.FilePathField(path=os.path.dirname(__file__), match=".*\.py$", blank=True)
|
|
|
|
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
|