test templates

This commit is contained in:
Sanj 2012-10-19 19:36:22 +05:30
parent 2d84b2269e
commit d5b85ecc92
3 changed files with 22 additions and 2 deletions

View File

@ -4,7 +4,8 @@ from django.template import RequestContext
from ox.django.shortcuts import render_to_json_response
import re
from django.http import HttpResponse, HttpResponseRedirect
from settings import PROJECT_ROOT
from os.path import join, exists
def add_object(request, module_slug, tab_slug):
tab = get_object_or_404(ModuleTab, slug=tab_slug)
@ -162,6 +163,23 @@ def render_object(request, module_slug):
})
return render_to_response("noel/render_object.html", context)
def test_template(request, template_name):
test_path = join(PROJECT_ROOT, "templates", "test_static_templates")
template_path = join(test_path, template_name + ".html")
if exists(template_path):
html = open(template_path).read()
else:
html = "Template not found."
context = RequestContext(request, {
'item': {},
'item_data': {'html': html},
'tab': {},
'object_list': [],
'tabs': []
})
return render_to_response("noel/render_object.html", context)
######
#HERE BE OLD DISCARED CODE:
#####

View File

@ -29,7 +29,7 @@ ItfFileUpload.prototype.upload = function() {
if (data.resultUrl) {
that.markDone(data);
} else {
that.$progressStatus.html(response.status);
that.$elem.find("progressStatus").html(response.status);
}
},
'progress': that.doProgress

View File

@ -42,6 +42,8 @@ urlpatterns = patterns('',
# to INSTALLED_APPS to enable admin documentation:
#Test views:
(r'test_profile', 'itfprofiles.views.person_form'),
(r'^test_template/(?P<template_name>[a-zA-Z].*?)$', 'insidepages.views.test_template'),
(r'edit_profile', 'itfprofiles.views.edit_profile'),
(r'^autocomplete/(?P<ctype_id>\d+)', 'app.views.autocomplete'),
(r'^popup_form/(?P<ctype_id>\d+)', 'app.views.popup_form'),