Ticket #6803: models.py

File models.py, 608 bytes (added by jhenry <jhenry@…>, 17 years ago)
Line 
1from django.db import models
2from django.contrib.auth.models import User
3from django.contrib.contenttypes import generic
4from django.contrib.contenttypes.models import ContentType
5
6
7class Pony(models.Model):
8 content_type = models.ForeignKey(ContentType)
9 object_id = models.PositiveIntegerField()
10 content_object = generic.GenericForeignKey()
11 purpleness = models.IntegerField(default=0)
12
13 class Meta:
14 unique_together = (
15 ('content_type', 'object_id'),
16 )
17
18class Person(models.Model):
19 user = models.ForeignKey(User)
20 pony = generic.GenericRelation(Pony)
Back to Top