On Wednesday 12 April 2006 07:03, nkeric wrote:
> hi all,
>
> I've done some search, however, I guess I should ask for your helps
> here:
>
> I have the following models: (pseudo code)
>
> class ArticleType:
>     name = ...
>
> class Article:
>     title = ...
>     article_type = meta.ForeignKey(ArticleType)
>
> class Game:
>     name = ...
>     articles = meta.ManyToManyField(Article)
>
> how can I retrive the articles of a certain article type of a given
> game?
>
> >>> g = games.get_object(pk=1)
> >>> g.get_article_list(article_type_id__exact=1)
>
> doesn't work, though I knew how to do this in raw sql...

As I understand it, Django should be able to do this query no problem.  
I think there may be a mistake in what you posted though - IIRC, I 
would have expected the method name to be 'get_articles_list' not 
'get_article_list', since you defined it as 'articles = 
meta.ManyToManyField(Article)'.  If you post the entire code for your 
models we may be able to find the problem.  Magic-removal branch 
doesn't really change what is possible here, it just changes the 
syntax.

Luke

-- 
"Humiliation: The harder you try, the dumber you look." (despair.com)

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

--~--~---------~--~----~------------~-------~--~----~
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