Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

José Francisco Martinez Salgado
PLUS
José Francisco Martinez Salgado
Courses Plus Student 1,074 Points

Foreing Key on 2 models on Django?

Hi I'm trying to build a project to test django, here's what I have done so far

class Label(models.Model): name = models.CharField(max_leght=100) oName = models.CharField(max_leght=100) foundationDate = models.DateField() description = models.TextField()

class Artists(models.Model): name = models.CharField(max_leght=100) oName = models.CharField(max_leght=100) label = models.ForeignKey(Label, on_delete=models.CASCADE) description = models.TextField()

class Meta:
    abstract = True

class Group(models.Model): name = models.CharField(max_leght=100) oName = models.CharField(max_leght=100) description = models.TextField() date = DateField() label = models.ForeignKey(Label, on_delete=models.CASCADE) members = models.ManyToManyField(Artists)

class OtherNames(models.Model): name = models.CharField(max_leght=100) label = models.ForeignKey(????, on_delete=models.CASCADE, related_name="otherNames")

But I want the model OtherNames to have 2 foreing keys, group and also artists, is there a way to do this? Also another model would be albums, an artist and a group can have multiple albums.