0

I am reading Andrew Pinkham's Django Unleashed as an intro to learning Django and see an unresolved issue in the viewing of related objects in an object's views. Here's a simple explanation:

Startups have related blog posts. Viewing of blog posts is limited by a permission: View_Future_Posts which restricts viewing of blog posts with pub_dates in the future to those who have this permission. I am using Generic Class Based views and when viewing Blog Posts (List or Detail) limit the queryset based on this permission by using a mixin which overrides get_allow_future method which checks the user's permission.

My question is, how do I limit the list of blog posts related to a Startup when viewing a Startup using the GCBV ListView?

Additionally, bc I am very new at this, where could I have looked to figure this out for myself?

Many thanks!

calJersey
  • 1
  • 1

1 Answers1

0

I figured out an answer. It is explained later in the book (should've just kept reading. apologies!) If interested:

create a model function for Startups that filters the blog posts queryset to only posts that have pub_date <= today. If user has permission to see future posts, display results from base queryset otherwise display results from filtered queryset.

calJersey
  • 1
  • 1