Opened 9 years ago

Closed 8 years ago

#6990 closed (duplicate)

Omit redundant user.is_authenticated check in django/contrib/admin/templates/admin/base.html

Reported by: Liang Feng <hutuworm@…> Owned by: Alexander Koshelev
Component: contrib.admin Version: newforms-admin
Severity: Keywords: nfa-someday
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Ramiro Morales)

In the admin template:

django/contrib/admin/templates/admin/base.html:
{% if user.is_authenticated and user.is_staff %}

While checking if user is staff, it's No need to check if user is authenticated. Since user who is not authenticated can't pass the "user.is_staff" check, so the "user.is_authenticated" check could be omitted.

p.s. may save some precious cpu cycles on Google App Engine. :P

Change History (5)

comment:1 Changed 8 years ago by Ramiro Morales

Description: modified (diff)

comment:2 Changed 8 years ago by Karen Tracey <kmtracey@…>

Keywords: nfa-someday added; omit redundant user.is_authenticated check removed
Triage Stage: UnreviewedDesign decision needed
Version: SVNnewforms-admin

The check wasn't redundant before the fix for #3032 went in.

Code is still there in newforms-admin so changing to that release and design decision needed for someone to decide whether it is worth removing the now-redundant check.

comment:3 Changed 8 years ago by Alexander Koshelev

Owner: changed from nobody to Alexander Koshelev

comment:4 Changed 8 years ago by Alexander Koshelev

See #6991 for patch

comment:5 Changed 8 years ago by Honza Král

Resolution: duplicate
Status: newclosed

duplicate of #6991

Note: See TracTickets for help on using tickets.
Back to Top