Вот моя проблема
![Trying to fetch the title field inside the _set all queryset in Django as you can see on the terminal window below](https://i.stack.imgur.com/9JwAi.png)
Я пытаюсь получить данные из модели страницы, которая связана с моделью объекта с помощью внешнего ключа.Есть ли способ, как быстро получить данные?
Вот мои views.py ![Views.py](https://i.stack.imgur.com/AsfXX.png)
urls.py
![enter image description here](https://i.stack.imgur.com/zJOs5.png)
Я пытаюсь получить заголовок поля из объекта page_set.filter.
Вот мой класс models.py
from django.db import models
from ckeditor.fields import RichTextField
# Create your models here.
class Subject(models.Model):
title = models.CharField(max_length = 200)
slug = models.SlugField(blank = False)
visible = models.BooleanField(default = True)
position = models.IntegerField()
date_published = models.DateTimeField(auto_now_add = True)
date_updated = models.DateTimeField(auto_now_add=False)
def __str__(self):
return self.title
class Page(models.Model):
subject = models.ForeignKey(Subject, on_delete= models.CASCADE)
title = models.CharField(max_length = 200)
slug = models.SlugField(blank = False)
description = models.TextField()
thumbs = models.ImageField(blank = True)
visible = models.BooleanField(default = True)
position = models.IntegerField()
date_published = models.DateTimeField(auto_now_add = True,auto_now=False)
date_updated = models.DateTimeField(auto_now_add=False, auto_now=True)
def __str__(self):
return self.title
Лента новостей (models.Model):
title = models.CharField(max_length = 200)
slug = models.SlugField(blank = False)
description = models.TextField()
thumbs = models.ImageField(blank = True)
visible = models.BooleanField(default = True)
position = models.IntegerField()
date_published = models.DateTimeField(auto_now_add = True)
date_updated = models.DateTimeField(auto_now_add=False)
def __str__(self):
return self.title