On Aug 23, 2015 10:05 AM, "Shekar Tippur" <ctip...@gmail.com> wrote: > > 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')
Have you tried adding 'id' to the fields tuple? -James -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV%2B%3DkBceatgLPSFri95KNiw1Q-e1gAFsv8rpBEPHq7i0g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.