Hello!
I'm setting up a blog, and for learning purposes I want to make everything as generic as possible.
My tagging app looks like this
------
class Tag(models.Model):
name = models.SlugField(max_length=30, unique=True)
class TagRelation(models.Model):
tag = models.ForeignKey(Tag)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
------
When showing one post, it's easy to get the tags using this method:
http://docs.djangoproject.com/en/1.2/ref/contrib/contenttypes/#reverse-generic-relations
But how can I do the same when I want to show more than one post in a single page and all of them shows which tags are attached to the post.
Thanks in advance
-Anders
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment