Hi, This is a simplified example about what I want to do. There are restaurants, they have categories (e.g. pizzeria, vegetarian, etc.) and a city the restaurant is in.
I have the following model (simplified): class Category(meta.Model): ... class City(meta.Model): ... class Restaurant(meta.Model): ... categories = meta.ManyToManyField (Category) city = meta.ForeignKey (Place) i.e. a restaurant can belong to several categories, but has only one place. Now how can I select all the restaurants that belong to a category and are in a given city? To get the restaurants from a city I can do: r = restaurants.get_list (city__id__exact=n) To get the restaurants belonging to a specific category I can do: r = category.get_restaurant_list() But is there a way to combine them? Comparing the results of the two queries to find the common items is not very optimal... I'm looking for something like r = restaurants.get_list(city__id__exact=n, categories__contain=category) Thanks in advance, Pistahh/freenode