Luke Plant wrote:
> 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 =
>
Luke Plant wrote:
>As I understand it, Django should be able to do this query no problem.
>
>
I also thought so :-). I created a test project with this model and
tried to get this query to work. "get_article_list" is indeed there but
it doesn't like 'article_type__id__exact' as an
nkeric wrote:
>Really? That's cool!
>
>
Yes. One of the great new features of m-r branch is that relation
queries work similary for M-M and 1-M relations and in both directions:
game.articles.filter(article_type__pk=1) # all articles for one game
of one type
article.game_set.all() #
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 =
nkeric wrote:
>Ivan, thanks a lot for your reply :)
>well, I guess I have to take the "dirty" sql approach :p
>
>
You might want to look into magic-removal branch where things like this
are made possible with ORM.
--~--~-~--~~~---~--~~
You received this
Ivan Sagalaev wrote:
> nkeric wrote:
>
> >hello, could anybody pls help? I don't want to write dirty sql if I
> >could do it via django ORM...
> >
> >
> Well... The only thing I could work out is this:
>
> articles = [a for a in g.get_article_list() if a.article_type_id == 1]
Ivan, thanks a lot
nkeric wrote:
>hello, could anybody pls help? I don't want to write dirty sql if I
>could do it via django ORM...
>
>
Well... The only thing I could work out is this:
articles = [a for a in g.get_article_list() if a.article_type_id == 1]
Drawbacks are obvious: it's always selects all
hello, could anybody pls help? I don't want to write dirty sql if I
could do it via django ORM...
BiG thanks! :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
Ivan Sagalaev wrote:
> g.get_article_list(article_type_id__exact=1)
> It's g.get_article_list(article_type__id__exact=1). Note 2 underscores
> before "id" which means field "id" of a parent table.
sorry for mistyped that, I tried this:
>>> g.get_article_list(article_type__id__exact=1)
nkeric wrote:
>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?
>
>
>
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 =
11 matches
Mail list logo