django-queryset

different queryset based on permissions in Django Rest Framework

怎甘沉沦 提交于 2020-12-10 16:52:18
问题 I have seen this link, but I didn't find anything related to my question helping it being resolved. Imagine we have to create a blog, in which posts have two status: is_draft published ( published == !is_draft ) So, each user should see all of his/her posts, whether it is draft or not. In addition, Other users should see the published posts of rest of the users. I am using viewsets in django and I know that we should have different queryset based on the current user permissions but I don't