Added the necessary files to test the generic relations

This commit is contained in:
Corey Oordt 2010-04-23 11:37:47 -04:00
parent 9e1717f3f7
commit c5759a17c6
3 changed files with 29 additions and 3 deletions

View file

@ -38,7 +38,7 @@ USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = APP + '/static/'
MEDIA_ROOT = APP + '/media/'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
@ -66,7 +66,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
ROOT_URLCONF = 'sample.urls'
ROOT_URLCONF = 'example.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
@ -80,10 +80,12 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.flatpages',
'categories',
'editor',
'mptt',
'simpletext',
)
EDITOR_MEDIA_PATH = '/static/editor/'
CATEGORIES_ALLOW_SLUG_CHANGE = True
CATEGORIES_ALLOW_SLUG_CHANGE = True
CATEGORIES_RELATION_MODELS = ['simpletext.simpletext','flatpages.flatpage']

View file

@ -0,0 +1,20 @@
function showGenericRelatedObjectLookupPopup(triggeringLink, ctArray) {
var realName = triggeringLink.id.replace(/^lookup_/, '');
var name = id_to_windowname(realName);
realName = realName.replace(/object_id/, 'content_type');
var select = document.getElementById(realName);
if (select.selectedIndex === 0) {
alert("Select a content type first.");
return false;
}
var selectedItem = select.item(select.selectedIndex).value;
var href = triggeringLink.href.replace(/#/,'../../../'+ctArray[selectedItem]+"/?t=id");
if (href.search(/\?/) >= 0) {
href = href + '&pop=1';
} else {
href = href + '?pop=1';
}
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
win.focus();
return false;
}

View file

@ -28,4 +28,8 @@ urlpatterns = patterns('',
(r'^static/editor/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': ROOT_PATH + '/editor/media/editor/',
'show_indexes':True}),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': ROOT_PATH + '/example/static/'}),
)