Opened 18 years ago

Closed 18 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: no UI/UX: no

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@… 18 years ago.
Patch
admin_js.patch (1.6 KB ) - added by Chris Beaven 18 years ago.

Download all attachments as: .zip

Change History (6)

by oyvind@…, 18 years ago

Attachment: admin_js_httpprefix.diff added

Patch

comment:1 by oyvind@…, 18 years ago

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

Marked as patch

comment:2 by Chris Beaven, 18 years ago

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.

by Chris Beaven, 18 years ago

Attachment: admin_js.patch added

comment:3 by Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedReady for checkin

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

comment:4 by Malcolm Tredinnick, 18 years ago

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