Commit 0af227bc authored by Michal Čihař's avatar Michal Čihař

Do not place widget templates in media directory

Issue #605
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent d7582f9b
...@@ -25,6 +25,7 @@ recursive-include examples * ...@@ -25,6 +25,7 @@ recursive-include examples *
recursive-include locale *.po recursive-include locale *.po
recursive-include locale *.mo recursive-include locale *.mo
include weblate/trans/tests/data/* include weblate/trans/tests/data/*
include weblate/trans/widget-images/*.png
include weblate/lang/plurals.txt include weblate/lang/plurals.txt
exclude weblate/settings.py exclude weblate/settings.py
prune docs/_build prune docs/_build
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from django.conf import settings
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.template.loader import render_to_string from django.template.loader import render_to_string
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
...@@ -126,8 +125,8 @@ class Widget(object): ...@@ -126,8 +125,8 @@ class Widget(object):
Returns widgets filename. Returns widgets filename.
''' '''
return os.path.join( return os.path.join(
settings.MEDIA_ROOT, os.path.dirname(__file__),
'widgets', 'widget-images',
'%(widget)s-%(color)s.png' % { '%(widget)s-%(color)s.png' % {
'color': self.color, 'color': self.color,
'widget': self.name, 'widget': self.name,
...@@ -317,8 +316,8 @@ class BadgeWidget(Widget): ...@@ -317,8 +316,8 @@ class BadgeWidget(Widget):
else: else:
mode = 'failing' mode = 'failing'
return os.path.join( return os.path.join(
settings.MEDIA_ROOT, os.path.dirname(__file__),
'widgets', 'widget-images',
'badge-%s.png' % mode 'badge-%s.png' % mode
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment