Commit f3a56d57 by Alex Gaynor

Reorder things for easier readability

parent d16b83b4
......@@ -3,6 +3,7 @@ from django.db import models
from taggit.managers import TaggableManager
from taggit.models import TaggedItemBase
class Food(models.Model):
name = models.CharField(max_length=50)
......@@ -19,23 +20,23 @@ class Pet(models.Model):
def __unicode__(self):
return self.name
class HousePet(Pet):
trained = models.BooleanField()
# test direct-tagging with custom through model
# Test direct-tagging with custom through model
class TaggedFood(TaggedItemBase):
content_object = models.ForeignKey('DirectFood')
class TaggedPet(TaggedItemBase):
content_object = models.ForeignKey('DirectPet')
class DirectFood(models.Model):
name = models.CharField(max_length=50)
tags = TaggableManager(through=TaggedFood)
class TaggedPet(TaggedItemBase):
content_object = models.ForeignKey('DirectPet')
class DirectPet(models.Model):
name = models.CharField(max_length=50)
......@@ -43,16 +44,19 @@ class DirectPet(models.Model):
def __unicode__(self):
return self.name
class DirectHousePet(DirectPet):
trained = models.BooleanField()
# test custom through model to model with custom PK
# Test custom through model to model with custom PK
class TaggedCustomPKFood(TaggedItemBase):
content_object = models.ForeignKey('CustomPKFood')
class TaggedCustomPKPet(TaggedItemBase):
content_object = models.ForeignKey('CustomPKPet')
class CustomPKFood(models.Model):
name = models.CharField(max_length=50, primary_key=True)
......@@ -60,10 +64,7 @@ class CustomPKFood(models.Model):
def __unicode__(self):
return self.name
class TaggedCustomPKPet(TaggedItemBase):
content_object = models.ForeignKey('CustomPKPet')
class CustomPKPet(models.Model):
name = models.CharField(max_length=50, primary_key=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment