Permalink
Browse files

Passing admin_genericadmin_obj_lookup url to genericadmin.js instead …

…of hard-coding
  • Loading branch information...
1 parent 07fc57f commit daec468cc22811f60cdd192eac47fd462accbcdd Kyle Rimkus committed May 30, 2012
@@ -7,7 +7,7 @@
(function($) {
var GenericAdmin = {
url_array: null,
- obj_url: "/admin/obj/",
+ obj_url: CKEDITOR.config.obj_lookup_url,
admin_media_url: window.__admin_media_prefix__,
prepareSelect: function(elem) {
return $(elem).parents('div.cke_dialog_page_contents').find('select.content_type').first();
@@ -151,7 +151,7 @@
var ImageEmbedAdmin = {
url_array: null,
- obj_url: "/admin/obj/",
+ obj_url: CKEDITOR.config.obj_lookup_url,
admin_media_url: window.__admin_media_prefix__,
showLookupLink: function() {
var that = this;
@@ -8,6 +8,7 @@
CKEDITOR.config.content_embed_options = {{ content_embed_options|safe }};
CKEDITOR.config.content_embed_urls = {{ content_embed_urls|safe }};
CKEDITOR.config.image_embed_url = '{{ image_embed_url }}';
+ CKEDITOR.config.obj_lookup_url = '{{ obj_lookup_url }}';
{% if filebrowser %}
CKEDITOR.config.filebrowserBrowseUrl = '/admin/filebrowser/browse/?pop=3';
View
@@ -12,6 +12,7 @@
from django.utils.safestring import mark_safe
from django.contrib.contenttypes.models import ContentType
from django.conf.urls.defaults import patterns, url
+from django.core.urlresolvers import reverse
CKEDITOR_CONFIGS = dict((k, json.dumps(v)) for k, v in settings.CKEDITOR_CONFIGS.items())
@@ -54,6 +55,7 @@ def render(self, name, value, attrs=None, **kwargs):
'content_embed_options': content_embed_options,
'content_embed_urls': json.dumps(content_embed_urls),
'image_embed_url': image_embed_url,
+ 'obj_lookup_url': reverse('admin_genericadmin_obj_lookup'),
# This "regex" should match the ID attribute of this field.
# The reason we use a regex is so we can handle inlines, which will have

0 comments on commit daec468

Please sign in to comment.