this is models.py and serializer.py
i want to return multiple models in one service 

i try with nested serializer but didnot work 
and aslo search  but no help


-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
class CommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Comments
        fields = '__all__'


class ProblemSerializer(serializers.ModelSerializer):
    class Meta:
        model = Problems
        # fields = '__all__'
        fields = ('content', 'publish_user','problem_rate', 'date')
class Replay(models.Model):
    user = models.ForeignKey(settings.AUTH_USER_MODEL)
    content = models.CharField(max_length=120)
    date = models.DateField()
#
class Comments(models.Model):
    user = models.ForeignKey(settings.AUTH_USER_MODEL)
    content = models.CharField(max_length=120)
    date = models.DateTimeField(auto_now=True, auto_now_add=False)
#     # reply = models.ManyToOneRel(Replay, blank=True, null=True)
#
class Problems(models.Model):
    content = models.CharField(max_length=500)
    publish_user = models.ForeignKey(settings.AUTH_USER_MODEL)
    comment = models.ForeignKey(Comments, blank=True, null=True)
    problem_rate = models.IntegerField()
    date = models.DateTimeField(auto_now=True, auto_now_add=False)

Reply via email to