Pulled out url fix into a util

This commit is contained in:
2017-09-30 15:25:06 -04:00
parent fd58ba1695
commit faf1a9d0ed
3 changed files with 12 additions and 3 deletions

8
OACPL/utils.py Normal file
View File

@ -0,0 +1,8 @@
from django.template.loader import render_to_string
from OACPL import settings
def url_fix_render_to_string(template, context):
temp = render_to_string(template, context)
return temp.replace('src="/', 'src="%s/' % settings.BASE_URL).replace('href="/', 'href="%s/' % settings.BASE_URL)