myles / django-photo-gallery

django-photo-gallery / templatetags / photos.py
100644 29 lines (22 sloc) 0.799 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Copyright (c) 2008, Myles Braithwaite
All rights reserved.
This software is provided without warranty under the terms of the BSD
license included in photos/LICENSE.markdown and may be redistributed only under
the conditions described in the aforementioned license. This license is also
available online at http://code.google.com/p/django-photo-gallery/wiki/License
Author: Myles Braithwaite
"""
 
from django import template
 
register = template.Library()
 
@register.simple_tag
def photo_media_prefix():
"""
Returns the string contained in the setitng PHOTOS_GALLERY_MEDIA_PREFIX.
This code is a copy of the Django Admin template tag `admin_media_prefix`.
"""
try:
from django.conf import settings
except ImportError:
return ''
return settings.PHOTOS_GALLERY_MEDIA_PREFIX