Skip to content

Commit

Permalink
Allow staff to view unpublished entries
Browse files Browse the repository at this point in the history
  • Loading branch information
marksweb committed Nov 21, 2024
1 parent 95b0d5b commit e22cf82
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions blog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def get_queryset(self):
return Entry.objects.published()

def get_context_data(self, **kwargs):
""" """
context = super().get_context_data(**kwargs)

events_queryset = Event.objects.future()
Expand Down Expand Up @@ -49,4 +48,10 @@ class BlogDayArchiveView(BlogViewMixin, DayArchiveView):


class BlogDateDetailView(BlogViewMixin, DateDetailView):
pass

def get_queryset(self):
"""Allows staff users to view unpublished entries"""
if self.request.user.is_staff:
return Entry.objects.all()
else:
return Entry.objects.published()

0 comments on commit e22cf82

Please sign in to comment.