From c929add2bf4f1d28e012419471b7cd215521cf87 Mon Sep 17 00:00:00 2001 From: vaishk Date: Wed, 24 May 2017 18:28:04 +0530 Subject: [PATCH] manytomany --- content/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/models.py b/content/models.py index a0ce59b..62cedda 100644 --- a/content/models.py +++ b/content/models.py @@ -74,8 +74,8 @@ class Content(models.Model): published = models.IntegerField() view = models.ForeignKey("Views", null=True, blank=True, db_column="view") place = models.CharField(max_length=255) - parentid = models.ForeignKey("Content", null=True, db_column='parentID', blank=True, limit_choices_to={'type_id': 3},) # Field name made lowercase. - related_contents = models.ManyToManyField('Content', through='ContentContent', related_name="+") + parentid = models.ForeignKey("Content", null=True, db_column='parentID', blank=True, limit_choices_to={'type_id': 3}, related_name="please_run") # Field name made lowercase. + content_related = models.ManyToManyField('Content', through='ContentContent', related_name= "run_run_run") def __unicode__(self): return self.title @@ -87,8 +87,8 @@ class Content(models.Model): class ContentContent(models.Model): - contentid1 = models.IntegerField(db_column='contentID1') # Field name made lowercase. - contentid2 = models.IntegerField(db_column='contentID2') # Field name made lowercase. + contentid1 = models.ForeignKey("content", db_column='contentID1', related_name="from_content") # Field name made lowercase. + contentid2 = models.ForeignKey("content", db_column='contentID2', related_name="to_content") # Field name made lowercase. class Meta: managed = False