Template Render Is Not Passing Pymongo Aggregate Variable To Template
I am trying to pass a variable from pymongo on my views.py to a template. I am not getting any errors but neither is my code being rendered to my template. views.py: def getthe
Solution 1:
Trimming this down to just what you're looking for at this point (and correcting some syntax in your template), try a list comprehension:
from django.shortcuts import render
def gettheAudit(request):
theURLs = [x for x in mycol.aggregate([{"$unwind":"$tags"},{'$match': {'tags.tag.name':'A A',}},{'$project': {'url': 1, 'AR': 1, 'tags.tag.name': 1, 'tags.variables': 1, '_id': 0}},])]
return render(request, 'templates/a.html', {'theURLs': theURLs})
templates/a.html:
<ul>
<li><h1>URLSSSS</h1></li>
{% for theURL in theURLs %}
<li>{{ theURL }}</li>
{% endfor %}
</ul>
Post a Comment for "Template Render Is Not Passing Pymongo Aggregate Variable To Template"