On Nov 16, 8:12 am, Continuation <selforgani...@gmail.com> 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 ContentType, TaggedItem has
> a direct ForeignKey to Bookmark.
>
> In that case is there something similar to GenericRelation that I can
> define for Bookmark so that I can still use Bookmark.objects.get
> (tags__tag='django') (or something similar) to find all bookmarks with
> the tag "django"?
>
> The doc said "You cannot access a reverse ForeignKey Manager from the
> class; it must be accessed from an instance", but  in this case I
> really need to start with the class Bookmark instead of an instance.
> So what can I do?
>
> Thanks.

It works exactly the same, as the document I linked to shows. The
syntax you give should work with a standard ForeignKey - did you try
it?
--
DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.


Reply via email to