Code

Opened 6 years ago

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

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

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by mattmcc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Dup of #3579.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.