Answer the question
In order to leave comments, you need to log in
How to use _set for OneToOne models?
You need to create a queryset that will contain all the fields of connected models.
class Route(models.Model):
name = models.CharField(max_length = 254, db_index=True, verbose_name='Имя")
description = models.TextField(max_length = 600, verbose_name='Описание')
class Post(models.Model):
title = models.CharField(max_length=100, verbose_name='Название', db_index=True)
description = models.TextField(max_length=600, verbose_name='Описание')
route = models.OneToOneField(Route, on_delete=models.CASCADE, verbose_name="Маршрут")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question