Django

Code

Ticket #6990 (closed: duplicate)

Opened 8 months ago

Last modified 5 months ago

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

Reported by: Liang Feng <hutuworm@gmail.com> Assigned to: alexkoshelev
Milestone: Component: django.contrib.admin
Version: newforms-admin Keywords: nfa-someday
Cc: Triage Stage: Design decision needed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by ramiro)

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

Attachments

Change History

06/16/08 15:52:36 changed by ramiro

  • needs_better_patch changed.
  • description changed.
  • needs_tests changed.
  • needs_docs changed.

06/28/08 15:26:26 changed by Karen Tracey <kmtracey@gmail.com>

  • keywords changed from omit redundant user.is_authenticated check to nfa-someday.
  • version changed from SVN to newforms-admin.
  • stage changed from Unreviewed to Design decision needed.

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.

07/12/08 04:42:28 changed by alexkoshelev

  • owner changed from nobody to alexkoshelev.

07/12/08 05:29:55 changed by alexkoshelev

See #6991 for patch

07/12/08 08:12:41 changed by Honza_Kral

  • status changed from new to closed.
  • resolution set to duplicate.

duplicate of #6991


Add/Change #6990 (Omit redundant user.is_authenticated check in django/contrib/admin/templates/admin/base.html)




Change Properties
Action