manytomany

This commit is contained in:
vaishk 2017-05-24 18:28:04 +05:30
parent 5a375cb8cc
commit c929add2bf

View File

@ -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