Jay Parlar wrote:
> That's a pretty neat way to do it, I'm going to have to try it out. Do
> you use a ManyToManyField between your actual objects (like a blog
> Post, for instance) and the ObjectTag?
>
> Jay P.

hi Jay,

Since the ObjectTag model is the m2m table between the actual object
(which will be tagged) and the Tag model, so, you just add the
GenericRalation to you target object would be ok:

class Post(models.Model):
    tags = models.GenericRelation(ObjectTag)

AFAIK, using the GenericForeignKey & GenericRelation does NOT create
any actual db tables or added any extra table fields, they've just
added a convenient way for easily access this kind of generic relation.
(let me know if I was wrong :)

you could simply remove the GenericForeignKey from the ObjectTag model
and remove the GenericRelation from the Post, then, via the
content_type & object_id fields of the ObjectTag, you can query for the
tags of a specific Post object by querying the ObjectTag & Tag table
together.

- Eric


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to