You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@propertydefposts(self) ->models.QuerySet:
"""Return only published posts."""returnself._posts.filter(
status="published",
date__lte=timezone.now(),
)
Can be changed to:
@propertydefposts(self) ->models.QuerySet:
"""Return only published posts."""returnself._posts
Or, I may be able to remove this and rename the related model to posts instead of _posts. I only called it _posts because I wanted to add some extra logic to the posts property. But this logic (only returning published posts) is now built into the default queryset of the manager.
The text was updated successfully, but these errors were encountered:
The following code in category.py, line 116:
Can be changed to:
Or, I may be able to remove this and rename the related model to
posts
instead of_posts
. I only called it_posts
because I wanted to add some extra logic to theposts
property. But this logic (only returning published posts) is now built into the default queryset of the manager.The text was updated successfully, but these errors were encountered: