Answers for "how to retrieve foreign key data in django"

1

select realted for foreign key table in django

TravelAgencyCharacteristics.objects.filter(
            travel_agency__in=travel_agency_ids).select_related('travel_characteristics')
Posted by: Guest on June-21-2021
0

django create foreignkey from id

### Specify `fk_id` ###

# Create
employee = Employee.objects.create(
  first_name='first',
  last_name='last',
  type_id=4,
)

# Edit
employee = Employee(first_name="Name", last_name="Name")
employee.type_id = 4
employee.save()
Posted by: Guest on August-25-2021

Code answers related to "how to retrieve foreign key data in django"

Python Answers by Framework

Browse Popular Code Answers by Language