Opened 15 years ago

Closed 14 years ago

Last modified 12 years ago

#10759 closed (duplicate)

UserAdmin views should use attribute or current model to lookup the template paths

Reported by: james Turnbull Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords: UserAdmin, add_view, user_change_password
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When overriding the add_view() and user_change_password() in UserAdmin I expected it to use the current model names to find the templates (like the rest of admin).

However, it was hardcoded to use admin/auth/user/add_form.html and admin/auth/user/change_password.html.

Attached patch adds in the path for the current model, falling back to the above for backwards compatibility.

Attachments (2)

admin_user_templates.diff (1.4 KB ) - added by james Turnbull 15 years ago.
admin_user_template_vars.diff (3.4 KB ) - added by james Turnbull 15 years ago.
More flexible version

Download all attachments as: .zip

Change History (14)

by james Turnbull, 15 years ago

Attachment: admin_user_templates.diff added

comment:1 by Alex Gaynor, 15 years ago

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:2 by james Turnbull, 15 years ago

Any chance this could get set for 1.1 rather than 1.2?

I only ask as it goes very well with my other (set for 1.1) patch here: #10694

comment:3 by Alex Gaynor, 15 years ago

That's a bug, this is, in my view, a feature, admittingly a totally low overhead, noncontroversial no work one, but where that bar lies is for a committer to decide, so I've been intentionally rather conservative here.

comment:4 by james Turnbull, 15 years ago

Cool, thanks for taking the time to explain.

by james Turnbull, 15 years ago

More flexible version

comment:5 by james Turnbull, 15 years ago

Summary: UserAdmin views should use the current model to lookup the template pathsUserAdmin views should use attribure or current model to lookup the template paths
Triage Stage: AcceptedUnreviewed

After thinking about this further, I've submitted a new patch and knocked this bug back to "Unreviewed". Apologies for messing it around.

Taking cues from ModelAdmin, this version first looks for local attributes add_form_template and change_password_template before then attempting the template based off the models name, and finally falling back to the auth.user template (for backwards compatiblity).

Also to follow the convention of ModelAdmin in this version I define a variable for the context and pass that into render_to_response rather than defining a variable for the templates as I did in the previous patch.

comment:6 by james Turnbull, 15 years ago

Summary: UserAdmin views should use attribure or current model to lookup the template pathsUserAdmin views should use attribute or current model to lookup the template paths

Fixed a typo in the Summary.

comment:7 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:8 by James Bennett, 14 years ago

milestone: 1.2

1.2 is feature-frozen, moving this feature request off the milestone.

comment:9 by james Turnbull, 14 years ago

milestone: 1.3

This patch is ready to go and accepted - can someone push this into Django 1.3?

comment:10 by james Turnbull, 14 years ago

Resolution: duplicate
Status: newclosed

This was mostly fixed in #12218, so closing as a dupe.

comment:11 by james Turnbull, 14 years ago

Apologies, I meant: [12218]

comment:12 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

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