I have two Django models with are related to each other through a many-to-many relationship.
I need to list the cross product of both tables.
Let say for simplicity's sake that the two models are Pizza and Topping.
I would like the query to return something like this:
pizza_name topping
---------------------
all dressed cheese
all dressed mushrooms
all dressed onions
all dressed peperoni
all dressed pepper
reddit cheese
reddit peperoni
reddit bacon
reddit baconbits
The amount of data will be very large and I absolutely need to use count and slices so I can't simply iterate a model and treat the data as I go along.
Any idea how I should proceed?
I eventually solved it by simply iterating on the intermediate table.