Opened 8 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: alexkoshelev
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)

In the admin template:

{% 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

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

  • Keywords nfa-someday added; omit redundant user.is_authenticated check removed
  • Triage Stage changed from Unreviewed to Design decision needed
  • Version changed from SVN to newforms-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 alexkoshelev

  • Owner changed from nobody to alexkoshelev

comment:4 Changed 8 years ago by alexkoshelev

See #6991 for patch

comment:5 Changed 8 years ago by Honza_Kral

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #6991

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