Hello,
-- I am looking for a model/serializer/view for a self join. I can have nested paernt child relationship.
The one I am trying:
model:
class ParentChild(models.Model):
parent=models.CharField(max_length=100, blank=False, default='', unique=True)
child=models.ForeignKey('self', blank=True, null=True )
Serializer
class ParentChileSerializer(serializers.ModelSerializer):
class Meta:
model = ParentChild
fields = ('id', 'parent','child_id')
View
??
Not sure how to proceed. Appreciate any help.
- Shekar
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+unsubscribe@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/b4bd6e40-b9ac-4b55-8631-f06417634b3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment