#11478 closed (fixed)
jsi18n loading from templates within django/contrib/admin/templates/ shouldn't use "../"s
Reported by: | Owned by: | Jannis Leidel | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
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 creating a custom change_form.html for use on a different url to the usual create item locations I discovered that the jsi18n scripts were failing to load (side effecting various elements on the page such as many to many selectors collapsable fieldsets). I tracked this down to the fact that the javascript was being loaded relative to the location of the page. After further investigation I noticed that the following templates also used the same style of importing for javascript (all within the django/contrib/admin/templates directory).
admin/auth/user/change_password.html
admin/change_form.html
admin/change_list.html
Is it possible that these imports could be altered to use some sort of url reversal?
The svn version I have checked this against was 11231 although it seems to be there in 1.0.2 also.
Attachments (1)
Change History (9)
by , 15 years ago
Attachment: | 11478-jsi18n-reverse-urls-needs-10061.diff added |
---|
comment:1 by , 15 years ago
Has patch: | set |
---|
comment:2 by , 15 years ago
comment:3 by , 15 years ago
That patch seems to do the job. The javascript is now loading fine for me wherever I access it from.
Thanks!
comment:4 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:5 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 by , 15 years ago
comment:8 by , 14 years ago
Could/should the i18n_javascript() method of AdminSite be improved to include JS catalogs from all or selected INSTALLED_APPS? The way it is now, you can easily create the appropriate JS message files as desribed in the Django manual, but only the package "django.conf" is loaded by said method.
Actually loading your custom catalog for the admin is a bit tedious now. You basically have to duplicate said method and add a custom URL to your ModelAdmin and put a script tag in the corresponding admin template.
Patch for this issue, it depends on recent patch for #10061 from Russell being applied first