Wow - that's *exactly* the way I ended up doing it!
It took me a full working day to figure it out though. I'll post up a
snippet when I'm at work tomorrow. Basically the same thing except
filtering with pk and not name- I looped through the exact matches and
then excluded the rest.
On Sep 15,
Try this:
I'm assuming you define Article.category as a ManyToMany field? I also
assumed for the example that Category has a name field.
# Build a queryset of all categories not in desired set, e.g., 'Exact1' and
'Exact2'
bad_categories = Category.objects.exclude(category_name__in=['Exact1',
'Exa
Say for example you have two models:
Article
Category
Articles can have multiple categories.
How would you go about finding the Articles that contain only a
certain set of Categories?
The 'in' operator doesn't do me any good. Excludes look like they are
needed...
I'm in a situation where qui
3 matches
Mail list logo