Skip to content

Commit

Permalink
adding env filter
Browse files Browse the repository at this point in the history
  • Loading branch information
gvn committed Oct 1, 2018
1 parent 6bcebf0 commit 64f93ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{% load criterion %}
{% load product-update %}
{% load yes_no %}
{% load env %}

{% block body-id %}TODO-CATEGORY{% endblock %}

{% block guts %}
<div class="container-fluid text-center product-header bg-gray">

<img class="mb-0" src="{{mediaUrl}}{{AWS_LOCATION}}{{product.image}}" width="500"/>
<img class="mb-0" src="{{mediaUrl}}{{"AWS_LOCATION"|env}}{{product.image}}" width="500"/>
</div>
<div class="container">

Expand Down
12 changes: 12 additions & 0 deletions network-api/networkapi/buyersguide/templatetags/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django import template
from django.conf import settings

register = template.Library()


@register.filter
def env(value):
if hasattr(settings, value):
return getattr(settings, value)
else:
return ""

0 comments on commit 64f93ae

Please sign in to comment.