How to Use the Related Name Attribute in Django

preview_player
Показать описание
In this video I will talk about how to use the related name attribute in Django. This attribute is important for models that have multiple foreign keys to the same model.

Рекомендации по теме
Комментарии
Автор

This helped solve the problem I was struggling with for like two hours, thank you!!

dianalovette
Автор

Pretty simple and straightforward explanation. Thank you for sharing it with us :)

cassiosalvador
Автор

this is what i've been looking for. Thank you :)

atilaguler
Автор

Thank you my dude. This really helped me.

chasefite
Автор

God bless you man... You save an hour of mine. 👍👍

RajanKumar-olqf
Автор

Great content Anthony, A huge fan from Nigeria. I am about to begin your Django tutorial series. I just finished Flask Series and I'm pretty good with Flask. :) Continue to make good contents for us. Thanks a lot

madukomablessed
Автор

great... explained so neatly... thank you.

aditya.pradhan
Автор

Thanks for explain is pretty simple.
If I have two foreignkey from two different classes . Can they get the same related_name?

mahmoodali
Автор

what if we have another class object attribute in subject model and how can we relate it to the student model class object attribute minor using the foreignkey

pranayreddy
Автор

HELLo... i want to do a oniline courses website ... and each course should have lectures but when i call it in the template i get the course name repeated with only one lecture .. help plz !!!

Youssouf_Maroci
Автор

So the related_name need only for the ORM ? what the analogy in SQL?

RuslanSkiraUkraine
Автор

Hi brother, would you please help me, I am new in Django I have two models by name of Buildings(Name, Status, Descriptions) and Floors (Building as foreign key, Name, Status, Descriptions) now in the Floors form I want to display only the building which their status is true.

shansabitjourney
Автор

hi bro can u suggest me what i have to do after Django web-development.I m confused what to start next

shubhamsharma
Автор

thanks for the help man, But is null=True same as blank=True?

ramyaksharma
Автор

Is it just curiousity or math majors just happen to know a lot more than just math

akifazwad
Автор

class Client(models.Model):
name = models.CharField('Name', max_length=250)
surname = models.CharField('Surname', max_length=250)
phone = models.CharField('Phone', max_length=10)
...
def __str__(self):
return str(self.surname ) + ' | ' + str(self.name)

class Checklist(models.Model):
client_name = models.ForeignKey(Client, on_delete=models.CASCADE)
point1 = models.BooleanField('point1', default=False)
point2 = models.BooleanField('point2', default=False)
point3 = models.BooleanField('point3', default=False)
...
def __str__(self):
return self.client_name

How can i provide or add all Client properties to Checklist instance? (note: I create Checklist object via forms.py) And when it's done how to get an access to Client properties using Checklist object?

ches_ter
Автор

math.major.all() ==> why can't I do this?

bakalimao