Remove unnecessary query when not logged in
This commit is contained in:
parent
fff7a08aee
commit
5260669693
1 changed files with 2 additions and 0 deletions
|
@ -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()}
|
||||
|
||||
|
||||
|
|
Reference in a new issue