Skip to content

Commit f6988e9

Browse files
delsimGibbsConsulting
authored andcommitted
Allow media files to propagate through dpd middleware (#211)
* Move from staticfiles to static in demo template load tag * Update messaging template No test, but should address #209
1 parent c445973 commit f6988e9

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

demo/demo/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
{% load plotly_dash%}
5-
{% load staticfiles%}
5+
{% load static%}
66
{% load bootstrap4%}
77
{% bootstrap_css%}
88
{% bootstrap_javascript jquery="full"%}

django_plotly_dash/middleware.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,18 @@ def __call__(self, request):
133133

134134
response = self.get_response(request)
135135

136-
content = response.content
136+
try:
137+
content = response.content
138+
139+
for source, target in self.substitutions:
140+
content = content.replace(source, target)
141+
142+
response.content = content
137143

138-
for source, target in self.substitutions:
139-
content = content.replace(source, target)
144+
except AttributeError:
145+
# Not all files can contain substitutions, so ignore them
146+
pass
140147

141-
response.content = content
142148
return response
143149

144150
def _encode(self, string):

django_plotly_dash/templates/django_plotly_dash/plotly_messaging.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{%load staticfiles%}
1+
{%load static%}
22
<script src="{%static "channels/js/websocketbridge.js"%}"></script>
33
<script>
44
if( !window.dpd_wsb ) {

django_plotly_dash/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
2424
'''
2525

26-
__version__ = "1.1.2"
26+
__version__ = "1.1.3"

0 commit comments

Comments
 (0)