Mercurial > public > sg101
comparison gpp/comments/models.py @ 399:24f1230f3ee3
Fixing #193; reduce news query counts by grabbing tags and comment counts in bulk. Increased news items per page from 5 to 10.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 26 Mar 2011 03:08:05 +0000 |
parents | 254db4cb6a86 |
children |
comparison
equal
deleted
inserted
replaced
398:701730b2fcda | 399:24f1230f3ee3 |
---|---|
29 | 29 |
30 | 30 |
31 class Comment(models.Model): | 31 class Comment(models.Model): |
32 """My own version of a Comment class that can attach comments to any other model.""" | 32 """My own version of a Comment class that can attach comments to any other model.""" |
33 content_type = models.ForeignKey(ContentType) | 33 content_type = models.ForeignKey(ContentType) |
34 object_id = models.PositiveIntegerField() | 34 object_id = models.PositiveIntegerField(db_index=True) |
35 content_object = generic.GenericForeignKey('content_type', 'object_id') | 35 content_object = generic.GenericForeignKey('content_type', 'object_id') |
36 user = models.ForeignKey(User) | 36 user = models.ForeignKey(User) |
37 comment = models.TextField(max_length=COMMENT_MAX_LENGTH) | 37 comment = models.TextField(max_length=COMMENT_MAX_LENGTH) |
38 html = models.TextField(blank=True) | 38 html = models.TextField(blank=True) |
39 creation_date = models.DateTimeField() | 39 creation_date = models.DateTimeField() |