Opened 17 years ago
Closed 14 years ago
#5392 closed (fixed)
[newforms-admin] - hooks for template names
Reported by: | Owned by: | nobody | |
---|---|---|---|
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: | yes |
Easy pickings: | no | UI/UX: | no |
Description
I think it is possible to have more admin sites in one project. And it would be nice to have different default templates for these two sites - these templates should be independent on application.
So I would like to have some hooks as changelist_templates, add_templates and so on. For example this code could be changed:
class ModelAdmin(BaseModelAdmin): def changelist_view(self, request): ### ... return render_to_response(['admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower()), 'admin/%s/change_list.html' % app_label, 'admin/change_list.html'], context_instance=c)
New variant:
class ModelAdmin(BaseModelAdmin): def changelist_view(self, request): ### ... return render_to_response(self.changelist_templates(app_label, opts.object_name.lower()), context_instance=c) def changelist_templates(self, app_label, object_label): return ['admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower()), 'admin/%s/change_list.html' % app_label, 'admin/change_list.html']
I haven't need it yet so I have no patch. But it is no problem for me to create it - if you think it is a good idea.
Attachments (2)
Change History (7)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
by , 17 years ago
Attachment: | 04-admin-template-names.diff added |
---|
comment:3 by , 17 years ago
I am sorry, my patch depends on some other patches - it is for simple merging. So my patch can't be applied without problem. But I would like to prepare proper patch, if it would be accepted.
comment:4 by , 17 years ago
Keywords: | nfa-someday added; newforms admin templates removed |
---|---|
Patch needs improvement: | set |
This functionality is not critical before the merge to trunk. Tagging with nfa-someday.
by , 17 years ago
Attachment: | 02-admin-template-names.diff added |
---|
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is now possible to you things like ModelAdmin.change_list_template in the current admin.
Why is the function render_change_form in views/main.py? I think it could be a method of ModelAdmin. This move would be usefull for this ticket.