Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#11478 closed (fixed)

jsi18n loading from templates within django/contrib/admin/templates/ shouldn't use "../"s

Reported by: greatlemer <greatlemer+django@…> 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)

11478-jsi18n-reverse-urls-needs-10061.diff (2.2 KB ) - added by Ramiro Morales 15 years ago.
Patch for this issue, it depends on recent patch for #10061 from Russell being applied first

Download all attachments as: .zip

Change History (9)

by Ramiro Morales, 15 years ago

Patch for this issue, it depends on recent patch for #10061 from Russell being applied first

comment:1 by Ramiro Morales, 15 years ago

Has patch: set

comment:2 by Ramiro Morales, 15 years ago

With #10061 fixed on r11250, now the patch should work when applied to trunk after hat revision. Please report back your experiences with it if you manage to give it a try.

comment:3 by greatlemer <greatlemer+django@…>, 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 Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:5 by Jannis Leidel, 15 years ago

Owner: changed from nobody to Jannis Leidel
Status: newassigned

comment:6 by Jannis Leidel, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [12138]) Fixed #11478 - Use namespacing for URLs to i18n JavaScript in admin.

comment:7 by Jannis Leidel, 15 years ago

(In [12238]) [1.1.X] Fixed #11478 - Use namespacing for URLs to i18n JavaScript in admin.

comment:8 by philomat, 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.

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