Code

Opened 8 years ago

Closed 7 years ago

#2869 closed enhancement (fixed)

[patch] Enable admin to get javascript from absolute urls

Reported by: oyvind@… Owned by: adrian
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@… 8 years ago.
Patch
admin_js.patch (1.6 KB) - added by SmileyChris 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by oyvind@…

Patch

comment:1 Changed 8 years ago by oyvind@…

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

Marked as patch

comment:2 Changed 8 years ago by SmileyChris

  • Summary changed from [patch] Enable admin to get javascript from another domain to [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 8 years ago by SmileyChris

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

  • Triage Stage changed from Unreviewed to Ready for checkin

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

comment:4 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(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@….

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.