I have 2 apps that are distinct and have no particular reason to talk to each other. This means I don't want to import either name in either app. All the work should be within a glue app.
I would like to write a glue app that would join to particular models via a ManyToManyField like:
In app customers,
class Customer(models.Model):
...
In app pizzas,
class Pizza(models.Model):
...
Then I would like to write the pizza-selling app that would go like this:
class PizzaSold(models.Model):
customer = models.ForeignKey(related_name='pizzas')
pizza = models.ForeignKey(related_name='customers')
objects = ManyRelatedManager()
so I can access pizzas from customers directly
pizza = Pizza.objects.all()[0]
for customer in pizza.customers:
#Do something cool
and customers from pizza within this new app.
How can I do that ?