Home ManytoMany field django template when models are in different apps
Reply: 0

ManytoMany field django template when models are in different apps

user602
1#
user602 Published in May 25, 2018, 8:58 am

My question is similar to this. I have 2 models linked with m2m field and I want to render the field in template. How can I do this when my 2 models are in different apps:

apps/qapp/models

class Area(models.Model):
    name = models.CharField(max_length=100, primary_key=True)
    def __unicode__(self):
        return self.name

apps/worksheets/models

class Place(models.Model):
    id = models.IntegerField(primary_key=True) 
    name = models.CharField(max_length=100, primary_key=True)
    area = models.ManyToManyField('qapp.Area',related_name='area')
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.56127 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO