Media Types/Display: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
Media type display pages are media type-specific |
Media type display pages are media type-specific |
||
[http://jinja.pocoo.org/docs/ Jinja2] templates. |
[http://jinja.pocoo.org/docs/ Jinja2] templates defined in the media type's <code>MEDIA_MANAGER['display_template']</code>. |
||
== |
== Set the template path == |
||
The path for the media type display template is configured in |
The path for the media type display template is configured in |
||
the |
the <code>MEDIA_MANAGER</code> object for each media type. |
||
The |
The <code>MEDIA_MANAGER</code> is configured in |
||
<code>(mediagoblin/)media_types/$MEDIA_TYPE/__init__.py</code>. |
|||
The path to the template should be relative to the |
|||
* The path to the template should be relative to the <code>mediagoblin/templates/</code> directory. |
|||
* The standard directory for media templates is <code>mediagoblin/templates/mediagoblin/media_displays</code> |
|||
THis is an example of a <code>MEDIA_MANAGER</code> dict, see the <code>display_template</code> key. |
|||
MEDIA_MANAGER = { |
|||
"human_readable": "Video", |
|||
"processor": process_video, # alternately a string, |
|||
# 'mediagoblin.media_types.image.processing'? |
|||
"sniff_handler": sniff_handler, |
|||
"display_template": "mediagoblin/media_displays/video.html", |
|||
"default_thumb": "images/media_thumbs/video.jpg", |
|||
"accepted_extensions": [ |
|||
"mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"]} |
Revision as of 20:45, 22 June 2012
- I'm currently working on this page
- Joar 16:29, 22 June 2012 (EDT)
Media type display pages are media type-specific
Jinja2 templates defined in the media type's MEDIA_MANAGER['display_template']
.
Set the template path
The path for the media type display template is configured in
the MEDIA_MANAGER
object for each media type.
The MEDIA_MANAGER
is configured in
(mediagoblin/)media_types/$MEDIA_TYPE/__init__.py
.
- The path to the template should be relative to the
mediagoblin/templates/
directory. - The standard directory for media templates is
mediagoblin/templates/mediagoblin/media_displays
THis is an example of a MEDIA_MANAGER
dict, see the display_template
key.
MEDIA_MANAGER = { "human_readable": "Video", "processor": process_video, # alternately a string, # 'mediagoblin.media_types.image.processing'? "sniff_handler": sniff_handler, "display_template": "mediagoblin/media_displays/video.html", "default_thumb": "images/media_thumbs/video.jpg", "accepted_extensions": [ "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"]}