As my models are in ManyToMany relationship so connection should be in both ways, but are not.
For example in the admin for the BusinessProfile section I am able to see the name and image fields of Services model as they are in a ManyToMany relationship, but this not the case for the opposite. I am unable to see BusinessProfile models field in Services model in admin.
Is my model structure correct?
models.py
class Service(models.Model):
name = models.CharField(max_length=50)
image = models.ImageField(upload_to='image', blank = True)
#business_profile = models.ManyToManyField("BusinessProfile", blank=True, related_name="business_of_services")
def __str__(self):
return "Service - {}".format(self.name)
class BusinessProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)
business_name = models.CharField(max_length=100, unique =True)
register_date = models.DateTimeField(default=timezone.now)
pan_number = models.IntegerField(unique=True)
pan_name = models.CharField(max_length=100)
address = models.TextField(max_length=200)
pincode = models.IntegerField()
city = models.CharField(max_length=50)
state = models.CharField(max_length=50)
service = models.ManyToManyField("Service", blank=True, related_name="services_of_business")
image = models.ManyToManyField("Service", related_name="image_of_business")
def __str__(self):
return "Business - {}".format(self.business_name)

