posts.py 563 B

123456789101112131415
  1. from ...threads.models import Thread
  2. from ...threads.permissions import exclude_invisible_threads
  3. from .threads import UserThreads
  4. class UserPosts(UserThreads):
  5. def get_threads_queryset(self, request, threads_categories, profile):
  6. return exclude_invisible_threads(
  7. request.user_acl, threads_categories, Thread.objects
  8. )
  9. def get_posts_queryset(self, user, profile, threads_queryset):
  10. return profile.post_set.select_related("thread", "poster").filter(
  11. thread_id__in=threads_queryset.values("id")
  12. )