I want to create URLs for CMS portion of project I have following models
class Category(models.Model):
name = models.CharField(max_length=150)
parent = models.ForeignKey('self', blank=True, null=True)
class Page(models.Model):
title = models.CharField(max_length=255)
content = models.TextField()
slug = models.CharField(max_length=255)
category = models.ForeignKey(Category, related_name='pages')
I want the following URL structure for my categories
/categories/{parent category}/
/categories/{parent category}/{child category}/.../{child category}/pages/
How would I accomplish this with DRF-Extensions or any other plugin?
There is a package for recursive serialization under DRF.
https://github.com/heywbj/django-rest-framework-recursive
There is an earlier discussion on stackoverflow: Django rest framework nested self-referential objects