Opened 10 years ago

Closed 10 years ago

#2869 closed enhancement (fixed)

[patch] Enable admin to get javascript from absolute urls

Reported by: oyvind@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Enable admin to get javascript from another domain

If admin js contains http:// ADMIN_MEDIA_PREFIX should not be prepended.

This is esp important to make wyswiyg editors work correctly since they need js not to be on a different domain than the pagre you are currently on

jsurl = 'http://%s/js/' % Site.objects.get_current().domain

class Side(models.Model):
    overskrift = models.CharField(maxlength=255)
    innhold = TextField()
    site = models.ForeignKey(Site, default=settings.SITE_ID)
    manager = CurrentSiteManager()


    class Admin:
        manager = CurrentSiteManager()
        js = [jsurl+'tinymce/jscripts/tiny_mce/tiny_mce.js',jsurl+'tmce.js']

Attachments (2)

admin_js_httpprefix.diff (735 bytes) - added by oyvind@… 10 years ago.
Patch
admin_js.patch (1.6 KB) - added by Chris Beaven 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by oyvind@…

Attachment: admin_js_httpprefix.diff added

Patch

comment:1 Changed 10 years ago by oyvind@…

Summary: Enable admin to get javascript from another domain[patch] Enable admin to get javascript from another domain

Marked as patch

comment:2 Changed 10 years ago by Chris Beaven

Summary: [patch] Enable admin to get javascript from another domain[patch] Enable admin to get javascript from absolute urls

I created this similar patch before checking for an existing ticket. My version checks for absolute urls (anything starting with '/' or containing '://').

Also, the patch contains a small addition to documentation to clarify this.

Changed 10 years ago by Chris Beaven

Attachment: admin_js.patch added

comment:3 Changed 10 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedReady for checkin

Good idea, since we're all serving static content from outside our Django servers, right? :)

comment:4 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [4692]) Fixed #2869 -- Do not append ADMIN_MEDIA_PREFIX to absolute-path URLs used for
included javascript. Based on patches from SmileyChris and oyvind@….

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