# HG changeset patch
# User Brian Neal
# Date 1449025111 21600
# Node ID a34daec7f936f406f91ffc889d6956978b661136
# Parent c6bd7308de497ccbac080b2fff99cba85e4b2990
Converting to ManifestStaticFilesStorage.
Got rid of all occurrences of STATIC_URL from Python code.
diff -r c6bd7308de49 -r a34daec7f936 bio/templatetags/bio_tags.py
--- a/bio/templatetags/bio_tags.py Sat Nov 28 22:16:29 2015 -0600
+++ b/bio/templatetags/bio_tags.py Tue Dec 01 20:58:31 2015 -0600
@@ -3,7 +3,6 @@
"""
from django import template
from django.conf import settings
-from django.core.cache import cache
from django.db.models import Count
import bio.flags
@@ -92,14 +91,14 @@
try:
name = bio.flags.FLAG_DATA[code]
except KeyError:
- code = 'zz'
- name = ''
+ src = None
+ else:
+ n = '24' if size == 'small' else '64'
+ src = "flags/{n}/{code}.png".format(n=n, code=code)
return {
- 'code': code,
+ 'src': src,
'name': name,
- 'size': size,
- 'STATIC_URL': settings.STATIC_URL,
}
@@ -111,9 +110,10 @@
annotate(count=Count('country')).order_by('country')
for rec in flag_data:
- rec['name'] = bio.flags.FLAG_DATA[rec['country']]
+ country = rec['country']
+ rec['name'] = bio.flags.FLAG_DATA[country]
+ rec['src'] = "flags/24/{}.png".format(country)
return {
'flag_data': flag_data,
- 'STATIC_URL': settings.STATIC_URL,
}
diff -r c6bd7308de49 -r a34daec7f936 bio/templatetags/elsewhere_tags.py
--- a/bio/templatetags/elsewhere_tags.py Sat Nov 28 22:16:29 2015 -0600
+++ b/bio/templatetags/elsewhere_tags.py Tue Dec 01 20:58:31 2015 -0600
@@ -2,7 +2,6 @@
Template tags for the elsewhere application.
"""
from django import template
-from django.conf import settings
register = template.Library()
@@ -13,5 +12,4 @@
'social_nets': user.social_network_profiles.all(),
'ims': user.instant_messenger_profiles.all(),
'websites': user.website_profiles.all(),
- 'STATIC_URL': settings.STATIC_URL,
}
diff -r c6bd7308de49 -r a34daec7f936 comments/templatetags/comment_tags.py
--- a/comments/templatetags/comment_tags.py Sat Nov 28 22:16:29 2015 -0600
+++ b/comments/templatetags/comment_tags.py Tue Dec 01 20:58:31 2015 -0600
@@ -8,7 +8,6 @@
{% render_comment_list [object] %}
"""
from django import template
-from django.conf import settings
from django.template.loader import render_to_string
from comments.models import Comment
@@ -163,6 +162,5 @@
qs = Comment.objects.for_object(object).select_related('user', 'user__profile')
return {
'comments': qs,
- 'STATIC_URL': settings.STATIC_URL,
}
diff -r c6bd7308de49 -r a34daec7f936 core/templatetags/core_tags.py
--- a/core/templatetags/core_tags.py Sat Nov 28 22:16:29 2015 -0600
+++ b/core/templatetags/core_tags.py Tue Dec 01 20:58:31 2015 -0600
@@ -21,21 +21,15 @@
register = template.Library()
-ICON_PARAMS = {
- True: (settings.STATIC_URL + 'icons/accept.png', 'Yes'),
- False: (settings.STATIC_URL + 'icons/delete.png', 'No'),
-}
-@register.simple_tag
+@register.inclusion_tag('core/bool_icon.html')
def bool_icon(flag):
- params = ICON_PARAMS[bool(flag)]
- return u"""""" % (
- params[0], params[1], params[1])
+ return {'flag': flag}
@register.inclusion_tag('core/comment_dialogs.html')
def comment_dialogs():
- return {'STATIC_URL': settings.STATIC_URL}
+ return {}
@register.inclusion_tag('core/max_users_tag.html')
@@ -79,7 +73,6 @@
return {
'title': title,
'url': url,
- 'STATIC_URL': settings.STATIC_URL,
}
@@ -182,7 +175,6 @@
birthdays.sort(key=lambda b: b.day)
return {
- 'STATIC_URL': settings.STATIC_URL,
'birthdays': birthdays,
'today': today,
}
diff -r c6bd7308de49 -r a34daec7f936 core/templatetags/script_tags.py
--- a/core/templatetags/script_tags.py Sat Nov 28 22:16:29 2015 -0600
+++ b/core/templatetags/script_tags.py Tue Dec 01 20:58:31 2015 -0600
@@ -6,22 +6,22 @@
register = template.Library()
-@register.simple_tag
+@register.inclusion_tag('core/script_tags.html')
def script_tags(libraries):
- s = ''
+ css = []
+ js = []
for library in libraries.split():
if library in settings.GPP_THIRD_PARTY_CSS:
for path in settings.GPP_THIRD_PARTY_CSS[library]:
- prefix = ''
- if not path.startswith('http'):
- prefix = settings.STATIC_URL
- s += '' % (prefix, path)
+ local = not path.startswith('http')
+ css.append((local, path))
if library in settings.GPP_THIRD_PARTY_JS:
for path in settings.GPP_THIRD_PARTY_JS[library]:
- prefix = ''
- if not path.startswith('http'):
- prefix = settings.STATIC_URL
- s += '' % (prefix, path)
+ local = not path.startswith('http')
+ js.append((local, path))
- return s
+ return {
+ 'css_sources': css,
+ 'js_sources': js,
+ }
diff -r c6bd7308de49 -r a34daec7f936 forums/templatetags/forum_tags.py
--- a/forums/templatetags/forum_tags.py Sat Nov 28 22:16:29 2015 -0600
+++ b/forums/templatetags/forum_tags.py Tue Dec 01 20:58:31 2015 -0600
@@ -37,7 +37,6 @@
def last_post_info(context, post):
return {
'post': post,
- 'STATIC_URL': context['STATIC_URL'],
'user': context['user'],
}
@@ -53,7 +52,6 @@
return {
'post': post,
'show_button': show_button,
- 'STATIC_URL': settings.STATIC_URL,
}
@@ -122,7 +120,6 @@
'form': form,
'submit_value': submit_value,
'is_ajax': is_ajax,
- 'STATIC_URL': settings.STATIC_URL,
}
@@ -155,7 +152,6 @@
"""Displays the "unread", "sticky", and "locked" icons for a given topic."""
return {
'topic': topic,
- 'STATIC_URL': settings.STATIC_URL,
}
@@ -194,4 +190,4 @@
if subtitle:
nav_list.append(dict(name=subtitle, url=None))
- return dict(nav_list=nav_list, STATIC_URL=settings.STATIC_URL)
+ return dict(nav_list=nav_list)
diff -r c6bd7308de49 -r a34daec7f936 news/templatetags/news_tags.py
--- a/news/templatetags/news_tags.py Sat Nov 28 22:16:29 2015 -0600
+++ b/news/templatetags/news_tags.py Tue Dec 01 20:58:31 2015 -0600
@@ -4,7 +4,6 @@
import datetime
from django import template
-from django.conf import settings
from news.models import Story
from news.utils import attach_extra_attrs
@@ -26,6 +25,5 @@
return {
'stories': stories,
- 'STATIC_URL': settings.STATIC_URL,
'on_home': True,
}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/bio/elsewhere_links.html
--- a/sg101/templates/bio/elsewhere_links.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/bio/elsewhere_links.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,15 +1,20 @@
+{% load static from staticfiles %}
{% if social_nets or ims or websites %}
{% for net in social_nets %}
- -
+ {% with 'elsewhere/'|add:net.icon_name as src %}
+
-
{{ net.name }}
+ {% endwith %}
{% endfor %}
{% for im in ims %}
- -
+ {% with 'elsewhere/'|add:im.icon_name as src %}
+
-
{{ im.name }}
+ {% endwith %}
{% endfor %}
{% for site in websites %}
- -
+
-
{{ site.name }}
{% endfor %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/bio/flag_icon.html
--- a/sg101/templates/bio/flag_icon.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/bio/flag_icon.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,10 +1,6 @@
-{% if code != 'zz' %}
- {% if size == 'large' %}
-
-
- {{ name }}
-
- {% else %}
-
- {% endif %}
+{% load static from staticfiles %}
+{% if src %}
+
+
{{ name }}
+
{% endif %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/bio/member_flags_tag.html
--- a/sg101/templates/bio/member_flags_tag.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/bio/member_flags_tag.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,7 +1,8 @@
+{% load static from staticfiles %}
{% if flag_data %}
{% for rec in flag_data %}
-
{% endfor %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/comments/comment.html
--- a/sg101/templates/comments/comment.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/comments/comment.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,3 +1,4 @@
+{% load static from staticfiles %}
{% load bio_tags %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/core/birthday_block.html
--- a/sg101/templates/core/birthday_block.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/core/birthday_block.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,7 +1,8 @@
{% extends 'side_block.html' %}
{% load bio_tags %}
{% load humanize %}
-{% block block_title %} {{ today|date:"F" }} Birthdays {% endblock %}
+{% load static from staticfiles %}
+{% block block_title %} {{ today|date:"F" }} Birthdays {% endblock %}
{% block block_content %}
{% if birthdays %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/core/bool_icon.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sg101/templates/core/bool_icon.html Tue Dec 01 20:58:31 2015 -0600
@@ -0,0 +1,6 @@
+{% load static from staticfiles %}
+{% if flag %}
+
+{% else %}
+
+{% endif %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/core/comment_dialogs.html
--- a/sg101/templates/core/comment_dialogs.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/core/comment_dialogs.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,10 +1,11 @@
+{% load static from staticfiles %}
-
+
-
+
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/core/script_tags.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sg101/templates/core/script_tags.html Tue Dec 01 20:58:31 2015 -0600
@@ -0,0 +1,17 @@
+{% load static from staticfiles %}
+
+{% for local, src in css_sources %}
+{% if local %}
+
+{% else %}
+
+{% endif %}
+{% endfor %}
+{% for local, src in js_sources %}
+{% if local %}
+
+{% else %}
+
+{% endif %}
+{% endfor %}
+
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/core/social_sharing_tag.html
--- a/sg101/templates/core/social_sharing_tag.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/core/social_sharing_tag.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,13 +1,14 @@
+{% load static from staticfiles %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/forums/last_post_info.html
--- a/sg101/templates/forums/last_post_info.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/forums/last_post_info.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,7 +1,8 @@
{% load bio_tags %}
{% load forum_tags %}
+{% load static from staticfiles %}
{% if post %}
-
+
{% forum_date post.creation_date user %}
{% profile_link post.user.username %}
{% else %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/forums/navigation_tag.html
--- a/sg101/templates/forums/navigation_tag.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/forums/navigation_tag.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,10 +1,11 @@
+{% load static from staticfiles %}
{% if nav_item.url %}{% endif %} {{ nav_item.name }}
+{% if nav_item.url %}{% endif %} {{ nav_item.name }}
{% endif %}
{% empty %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/forums/post_edit_button.html
--- a/sg101/templates/forums/post_edit_button.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/forums/post_edit_button.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,3 +1,4 @@
+{% load static from staticfiles %}
{% if show_button %}
-
+
{% endif %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/forums/show_form.html
--- a/sg101/templates/forums/show_form.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/forums/show_form.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,3 +1,4 @@
+{% load static from staticfiles %}
{% load core_tags %}
{{ form.body.errors }}{{ form.body }}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/forums/topic_icons_tag.html
--- a/sg101/templates/forums/topic_icons_tag.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/forums/topic_icons_tag.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,4 +1,5 @@
-{% if topic.has_unread %}{% endif %}
-{% if topic.sticky %}{% endif %}
-{% if topic.locked %}{% endif %}
+{% if topic.sticky %}{% endif %}
+{% if topic.locked %}{% endif %}
diff -r c6bd7308de49 -r a34daec7f936 sg101/templates/news/story_summary.html
--- a/sg101/templates/news/story_summary.html Sat Nov 28 22:16:29 2015 -0600
+++ b/sg101/templates/news/story_summary.html Tue Dec 01 20:58:31 2015 -0600
@@ -1,3 +1,4 @@
+{% load static from staticfiles %}
{% load tagging_tags %}
{% load bio_tags %}
{% load comment_tags %}
@@ -22,14 +23,14 @@
{% endif %}
{% if story.long_text %}
-
+
There is more to this story, continue reading ...
{% endif %}
Category: {{ story.category.title }}
-
+
{% if story.version == 0 %}
{{ story.comment_count }} comment{{ story.comment_count|pluralize }}
{% else %}
@@ -39,15 +40,15 @@
Comments are disabled
{% endif %}
{% endif %}
-
+
{% if user.is_authenticated %}
-
{% endif %}
{% if story.tag_list %}