Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a60abede
Commit
a60abede
authored
11 years ago
by
Andy Armstrong
Browse files
Options
Downloads
Plain Diff
Merge pull request #2524 from edx/andya/dev-show-template
Add the ability to view templates in a browser in development mode
parents
e09990ff
651d1afb
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cms/djangoapps/contentstore/views/dev.py
+16
-0
16 additions, 0 deletions
cms/djangoapps/contentstore/views/dev.py
cms/urls_dev.py
+1
-0
1 addition, 0 deletions
cms/urls_dev.py
with
17 additions
and
0 deletions
cms/djangoapps/contentstore/views/dev.py
+
16
−
0
View file @
a60abede
...
...
@@ -5,8 +5,24 @@ in a 404 error.
"""
# pylint: disable=W0613
from
edxmako.shortcuts
import
render_to_response
from
mako.exceptions
import
TopLevelLookupException
from
django.http
import
HttpResponseNotFound
def
dev_mode
(
request
):
"
Sample static view
"
return
render_to_response
(
"
dev/dev_mode.html
"
)
def
dev_show_template
(
request
,
template
):
"""
Shows the specified template as an HTML page.
e.g. /template/ux/reference/container.html shows the template under ux/reference/container.html
Note: dynamic parameters can also be passed to the page.
e.g. /template/ux/reference/container.html?name=Foo
"""
try
:
return
render_to_response
(
template
,
request
.
GET
.
dict
())
except
TopLevelLookupException
:
return
HttpResponseNotFound
(
"
Couldn
'
t find template {tpl}
"
.
format
(
tpl
=
template
))
This diff is collapsed.
Click to expand it.
cms/urls_dev.py
+
1
−
0
View file @
a60abede
...
...
@@ -7,4 +7,5 @@ from django.conf.urls import url
urlpatterns
=
(
url
(
r
'
^dev_mode$
'
,
'
contentstore.views.dev.dev_mode
'
,
name
=
'
dev_mode
'
),
url
(
r
'
^template/(?P<template>.+)$
'
,
'
contentstore.views.dev.dev_show_template
'
),
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment