A
A
Alexander2016-04-26 13:36:19
Django
Alexander, 2016-04-26 13:36:19

What is the correct way to get data from the bridle in this case?

employee model :

.....
class Employee(models.Model):
    full_name = models.CharField(max_length=60, verbose_name="Имя Фамилия")
    position = models.CharField(max_length=40, verbose_name="Должность")
    text = models.TextField(verbose_name="Об сотруднике")
    status = models.BooleanField(verbose_name="Статус", default=1)
.....

social_link model :
.....
class social_link(models.Model):
    employee = models.ForeignKey(Employee)
    url = models.CharField(max_length=100, verbose_name="URL ")
.....

I try to pull out
employees = Employee.objects.get(id=1)
print(employees.social_link)

But the error 'Employee' object has no attribute 'social_link' pops up.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2016-04-26
@kentuck1213

employees.social_link_set

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question