Opened 16 years ago

Closed 16 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: no UI/UX: no

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 by Ramiro Morales, 16 years ago

Description: modified (diff)

comment:2 by Karen Tracey <kmtracey@…>, 16 years ago

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 by Alexander Koshelev, 16 years ago

Owner: changed from nobody to Alexander Koshelev

comment:4 by Alexander Koshelev, 16 years ago

See #6991 for patch

comment:5 by Honza Král, 16 years ago

Resolution: duplicate
Status: newclosed

duplicate of #6991

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