/tests/regressiontests/comment_tests/models.py
Python | 34 lines | 21 code | 9 blank | 4 comment | 0 complexity | f878df211ae4bb085cfa57e5fca7ecf0 MD5 | raw file
1""" 2Comments may be attached to any object. See the comment documentation for 3more information. 4""" 5 6from django.db import models 7from django.test import TestCase 8 9class Author(models.Model): 10 first_name = models.CharField(max_length=30) 11 last_name = models.CharField(max_length=30) 12 13 def __str__(self): 14 return '%s %s' % (self.first_name, self.last_name) 15 16class Article(models.Model): 17 author = models.ForeignKey(Author) 18 headline = models.CharField(max_length=100) 19 20 def __str__(self): 21 return self.headline 22 23class Entry(models.Model): 24 title = models.CharField(max_length=250) 25 body = models.TextField() 26 pub_date = models.DateField() 27 enable_comments = models.BooleanField() 28 29 def __str__(self): 30 return self.title 31 32class Book(models.Model): 33 dewey_decimal = models.DecimalField(primary_key = True, decimal_places=2, max_digits=5) 34