jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 294 forks source link

Disable autoescape for pygment calls and set Angular version to 1.3.20 #228

Closed calebj closed 8 years ago

calebj commented 8 years ago

Django autoescapes all function calls in templates by default. To get the pygment call to display properly, this needs to be turned off.

Also, there is no Angular 1.3.30 yet.

jrief commented 8 years ago

sorry, I don't get the point here. I do not even want to show those includes. Doesn't this work in your environment, or what's the problem. This demo holds the code for this application: http://django-angular.awesto.com/form_validation/ Is there any problem I have overseen?

calebj commented 8 years ago

Without disabling autoescape, no, it doesn't work in my environment. Without it, the HTML generated by pygment is displayed instead of the formatted code. This ends up breaking Angular for the entire page. The code section of the server response is: <div ng-show="activeTab==='Form'">&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;djangular.forms&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NgFormValidationMixin&lt;/span&gt; ... </div> ... and so on instead of HTML.

For some reason, HTML returned by function calls isn't escaped on your server. But with no other changes from the git pull, the examples don't work on my system. I'm running django 1.9.1

jrief commented 8 years ago

Thanks for reporting and patching. This regression must have been introduced after df4686ff02c68422e93cf87d64f476b250842545 which was the last version published on the demo site. I now upgraded to your last version and now everything works again.