Remove unnecessary query when not logged in

This commit is contained in:
Gabriel Augendre 2021-03-20 11:26:44 +01:00
parent fff7a08aee
commit 5260669693

View file

@ -11,6 +11,8 @@ IGNORED_PATHS = [
def drafts_count(request):
if request.path in IGNORED_PATHS:
return {}
if not request.user.is_authenticated:
return {}
return {"drafts_count": Article.objects.filter(status=Article.DRAFT).count()}