2012/11/30 Shai Berger
> On Friday 30 November 2012, Marek Brzóska wrote:
> > Has the matter been completely put away?
> >
> > I would like to bring it up again.
> >
> > I have Articles and Categories. An Article belongs to Categories:
> >
> > class Category(model):
> > pass
> > class Article(m
On 30 marras, 19:16, Florian Apolloner wrote:
> On Friday, November 30, 2012 6:12:43 PM UTC+1, Shai Berger wrote:
>
> > live_articles = Article.objects.exclude(status="archived")
> > live_cats = Category.objects.filter(article__in=live_articles)
>
> That works and it has the positive side-effect
On 30 marras, 15:29, Marek Brzóska wrote:
> Has the matter been completely put away?
>
> I would like to bring it up again.
>
> I have Articles and Categories. An Article belongs to Categories:
>
> class Category(model):
> pass
> class Article(model):
> category = ManyToManyField(Category)
>
On Friday, November 30, 2012 6:12:43 PM UTC+1, Shai Berger wrote:
>
> live_articles = Article.objects.exclude(status="archived")
> live_cats = Category.objects.filter(article__in=live_articles)
>
That works and it has the positive side-effect to kill any mysql server in
a matter of seconds :)
On Friday 30 November 2012, Marek Brzóska wrote:
> Has the matter been completely put away?
>
> I would like to bring it up again.
>
> I have Articles and Categories. An Article belongs to Categories:
>
> class Category(model):
> pass
> class Article(model):
> category = ManyToManyField(Cate
To be fair, the query you describe is significantly more expensive than
Marek's query.
On Fri, Nov 30, 2012 at 10:20 AM, Tom Evans wrote:
> On Fri, Nov 30, 2012 at 2:51 PM, Marek Brzóska
> wrote:
> >
> >
> >
> > 2012/11/30 Tom Evans
> >>
> >> On Fri, Nov 30, 2012 at 1:29 PM, Marek Brzóska
> >
>
> >> What precisely is wrong with:
> >>
> >> Category.objects.exclude(article_status='archived')
> >
> > It excludes all categories that have at least one archived article.
> >
> > And I want categories that have at least one NOT archived article.
> >
> > Example: I have one category: politics. I
On Fri, Nov 30, 2012 at 2:51 PM, Marek Brzóska wrote:
>
>
>
> 2012/11/30 Tom Evans
>>
>> On Fri, Nov 30, 2012 at 1:29 PM, Marek Brzóska
>> wrote:
>> > Has the matter been completely put away?
>> >
>> > I would like to bring it up again.
>> >
>> > I have Articles and Categories. An Article belong
2012/11/30 Tom Evans
> On Fri, Nov 30, 2012 at 1:29 PM, Marek Brzóska
> wrote:
> > Has the matter been completely put away?
> >
> > I would like to bring it up again.
> >
> > I have Articles and Categories. An Article belongs to Categories:
> >
> > class Category(model):
> > pass
> > class Art
On Fri, Nov 30, 2012 at 1:29 PM, Marek Brzóska wrote:
> Has the matter been completely put away?
>
> I would like to bring it up again.
>
> I have Articles and Categories. An Article belongs to Categories:
>
> class Category(model):
> pass
> class Article(model):
> category = ManyToManyField(C
Has the matter been completely put away?
I would like to bring it up again.
I have Articles and Categories. An Article belongs to Categories:
class Category(model):
pass
class Article(model):
category = ManyToManyField(Category)
status = CharField(max_length=10)
Now I want all categories
"""
The exclude() option in its current form is unworkable on multi-valued
relations. I'd like to repeat that for emphasis: exclude() can *never*
obsolete direct negative lookups for multi-value relations.
"""
I do see a problem here: the equality ~Q(a=1) <-> Q(a__lt=1)|Q(a__gt=1) is
not correct i
Opps! ...
> ).extra(where=['`data_school`.`site_name` != RAE']
should be
).extra(where=['`data_school`.`site_name` != %s'], params=['RAE']
which is case-in-point for why helping me avoid extra() is a good
thing!
~Adam sM
--
You received this message because you are subscribed to the Go
On Oct 27, 6:26 am, Kääriäinen Anssi wrote:
>
> Adam Moore wrote:
> > It's also worth noting that Q() objects permit the unary negation
> > operator, but this also yields the undesired results of the exclude()
> > call:
> > Blog.objects.filter(~Q(entry__author_count=2),
> > entry__tag__name='dja
Quote:
"""
It's also worth noting that Q() objects permit the unary negation
operator, but this also yields the undesired results of the exclude()
call:
Blog.objects.filter(~Q(entry__author_count=2),
entry__tag__name='django')
"""
As far as I understand, this is exactly the query you want. The fil
Greetings! Thanks to everyone for Django!
Long story short, I believe certain queries that are straightforward
and easy in plain SQL are not directly achievable in Django at all.
Obviously, Django is flexible enough that there is a workaround - but
a workaround shouldn't be necessary in a framewor
16 matches
Mail list logo