I have 2 models in the same app cross referencing each other. One as a foreign key and another as many to many key.
class VideoEmbed(models.Model):
person = models.ForeignKey('Person')
title = models.CharField(max_length=250)
video = EmbedVideoField()
class Person(models.Model):
name = models.CharField(max_length=200)
born = models.DateField(blank=True, null=True)
video = models.ManyToManyField(VideoEmbed, related_name='video_embed', null=True, blank=True)
The reason why I wanted to do this is to link Person with its related videos as one person could have many videos. Now in the django admin site the videoembed model will record video against each person and accordingly these will be shown in the each instance of Person respectively.However in the django site I have to select each of these videos from a select box in the many to many relationship field.
I wanted this field to only show the videos that are linked to this instance via the videoembed model and not all of the videos added. Is there a way to do this? If not then may be I should be able to see 2 fields in this section instead one so that I can select the videos which are linked to a Person instance.