In models.py :
from django.db import models from django.utils.translation import ugettext as _ # Create your models here. class Category(models.Model): name = models.CharField(_(u"Name"), max_length=250) products = models.ManyToManyField("Product", verbose_name=_(u"Products"), \ blank=True, null=True, related_name="+") class Product(models.Model): name = models.CharField(_(u"Name"), max_length=250) category = models.ManyToManyField("Category", verbose_name=_(u"Category"), \ blank=True, null=True, related_name="+")
On the admin page: 
Question:
How can I establish the relationship between the products and category m2m fields in models.py so that on the admin page, as shown in the figure, b2 (product) is marked as belonging to a2 (category).
Any tips on introducing [products, categories] are welcome, thanks.
PS
I am new to Django. Sorry for my English.
source share