Hello,
I am using https://github.com/heywbj/django-rest-framework-recursive and it works great.
I seem to have a small issue with it. When I try a GET operation on it, I dont seem to get the ID in the result. I want ID to be part of the result so that I can filter further on parent_id.
Model:
class RecursiveModel(models.Model):
stage_title = models.CharField(max_length=255, unique=True)
parent = models.ForeignKey('self', null=True)
created = models.DateTimeField(auto_now_add=True)
View:
class MySerializer(serializers.ModelSerializer):
parent = RecursiveField(allow_null=True, read_only=True)
class Meta:
managed = True
model = RecursiveModel
fields = ( 'stage_title', 'parent')
Appreciate any help in this regard.
Have you tried adding 'id' to the fields tuple?
-James