Custom SQL Function; Outputs Template-Friendly Content
This will return a template-friendly list of dictionaries when using custom SQL. The dictionary can be accessed just as a normal model/queryset. Example of use (in view): qkeys = ['artist','album'] query = """ SELECT "artist","album" FROM "music" """ new_list = csql(request,query,qkeys) (in template) {% for row in new_list %} {{ row.artist }} {{ row.album }} {% endfor %}
- templates
- custom-sql