У меня есть модель страницы с GFK .
class Page(models.Model):
title = models.CharField(max_length=200)
content_type = models.ForeignKey(ContentType,null=True,blank=True)
object_id = models.CharField(max_length=255,null=True,blank=True)
content_object = generic.GenericForeignKey('content_type', 'object_id')
и
class TextContent(models.Model):
content = models.TextField(null=True, blank=True)
pages = generic.GenericRelation(Page)
Я использую Page.objects.get (pk = 1) .content_object, и я понял.
Помогите мне, пожалуйста, показать ссылку (или вывод в JSON), которая привязана к объекту в REST.
class PageResource(ModelResource):
content_object = fields.?????
class Meta:
queryset = Page.objects.all()
resource_name = 'page'
Как это правильно делать?
Спасибо!
Виталий