How can I provide a queryset field for a subclass of a one-to-many relation in Django?
Example:
class Concept(models.Model):
...
class StudyResource(models.Model):
concept = models.ForeignKey(Concept, on_delete=models.CASCADE)
...
class VideoStudyResource(StudyResource):
...
Django provides:
concept.studyresource_set.all()
how can I also provide:
concept.videostudyresource_set.all()
Appreciate any suggestions.
One-To-Many
relationships in Django you need to use ForeignKey
.ForeignKey
backwards from Concept
to VideoStudyResource
.Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments