Opened 16 years ago

Closed 16 years ago

#9051 closed (duplicate)

Adding a user in the admin site relies on TEMPLATE_STRING_IF_INVALID

Reported by: TheShark Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The form action for the new user form ends up with the value of TEMPLATE_STRING_IF_INVALID appended onto the end of it.For example, putting
TEMPLATE_STRING_IF_INVALID = "Unknown"
into settings.py results in /admin/auth/user/add/ having this action, which can't be submitted.
<form action="Unknown" method="post" id="user_form">

Changing the form template file templates/admin/change_form.html so that the action line is generated with an {% if form_url %} prevents this. There may be other templates with this same bug. There are some with similar variable expansions in the 'action=' field, but I don't know if they are ever called with unset variables.

<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{% if form_url %}{{ form_url }}{% endif %}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %}

Change History (1)

comment:1 by Matt McClanahan, 16 years ago

Resolution: duplicate
Status: newclosed

Dup of #3579.

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