parts/django/tests/regressiontests/comment_tests/models.py
changeset 307 c6bca38c1cbf
equal deleted inserted replaced
306:5ff1fc726848 307:c6bca38c1cbf
       
     1 """
       
     2 Comments may be attached to any object. See the comment documentation for
       
     3 more information.
       
     4 """
       
     5 
       
     6 from django.db import models
       
     7 from django.test import TestCase
       
     8 
       
     9 class 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 
       
    16 class 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 
       
    23 class 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 
       
    32 class Book(models.Model):
       
    33     dewey_decimal = models.DecimalField(primary_key = True, decimal_places=2, max_digits=5)
       
    34