Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.