Hi > Le 22 déc. 2016 à 06:58, korea k <[email protected]> a écrit : > > class PostSet(models.Model): > title = models.CharField(max_length=50, verbose_name=u'title') > introduce = models.CharField(u'introduce', max_length=50) > > class Post(model.Model): > title = models.CharField(max_length=50, verbose_name=u'title') > introduce = models.CharField(u'introduce', max_length=50) > > > class ShowSerialzer(serializers.Serialize): > title = serializers.CharField() > introduce = serializers.CharField() > > > post = Post.objects.all() > post_set = PostSet.objects.all() > > How I can comebine two queryset( as above post, post_set ) from two different > model combine to one ShowSerialzer? >
It’s as simple as adding query sets together: full_data = list(post) + list(post_set) ShowSerialzer(data=full_data) Regards, Xavier Ordoquy, Linovia. -- 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.
