Re: Questions about ContentType generic relations

2009-11-16 Thread Daniel Roseman
On Nov 16, 8:12 am, Continuation wrote: > > As the docs show, when you've defined a GenericRelation, querying is > > exactly the same as with a reverse foreign key. So: > > Bookmark.objects.get(tags__tag='django') > > A somewhat related question: > > What if instead of having a ForeignKey to Conte

Re: Questions about ContentType generic relations

2009-11-16 Thread Continuation
> As the docs show, when you've defined a GenericRelation, querying is > exactly the same as with a reverse foreign key. So: > Bookmark.objects.get(tags__tag='django') > A somewhat related question: What if instead of having a ForeignKey to ContentType, TaggedItem has a direct ForeignKey to Book

Re: Questions about ContentType generic relations

2009-11-15 Thread Dennis Kaarsemaker
On zo, 2009-11-15 at 00:13 -0800, Continuation wrote: > I checked out the doc (http://docs.djangoproject.com/en/dev/topics/db/ > queries/) and can't find reference to it. Can you explain its usage a > bit more or point me to the relevant section of the doc? http://docs.djangoproject.com/en/dev/to

Re: Questions about ContentType generic relations

2009-11-15 Thread Daniel Roseman
On Nov 15, 8:13 am, Continuation wrote: > > As the docs show, when you've defined a GenericRelation, querying is > > exactly the same as with a reverse foreign key. So: > > Bookmark.objects.get(tags__tag='django') > > I don't quite understand your use of tags__tag='django' in retrieving > the obje

Re: Questions about ContentType generic relations

2009-11-15 Thread Continuation
> > As the docs show, when you've defined a GenericRelation, querying is > exactly the same as with a reverse foreign key. So: > Bookmark.objects.get(tags__tag='django') > I don't quite understand your use of tags__tag='django' in retrieving the objects. I've never seen this usage before. I che

Re: Questions about ContentType generic relations

2009-11-14 Thread esatterwh...@wi.rr.com
You might want to do a search on django-tagging. this has been done and done well. On Nov 13, 6:04 pm, Continuation wrote: > How do I do queries when ContentType is involved? > > Using the example in the doc > (http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 > ) > > class Tagg

Re: Questions about ContentType generic relations

2009-11-14 Thread Daniel Roseman
On Nov 14, 12:04 am, Continuation wrote: > How do I do queries when ContentType is involved? > > Using the example in the doc > (http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 > ) > > class TaggedItem(models.Model): >     tag = models.SlugField() >     content_type = models.Fo

Questions about ContentType generic relations

2009-11-13 Thread Continuation
How do I do queries when ContentType is involved? Using the example in the doc ( http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 ) class TaggedItem(models.Model): tag = models.SlugField() content_type = models.ForeignKey(ContentType) object_id = models.PositiveInte