I am a complete newbie to Django. I need to perform the following query and use img.img_loc to populate a list of images in a template:
SELECT img.img_loc, author.surname, author.given_name, author.email
FROM image_full AS img
LEFT JOIN author_contact_zzz AS author ON img.pmcid = author.pmcid
WHERE img.pmcid = 545600
GROUP BY img.img_loc, author.email;
I read the documentations here: https://docs.djangoproject.com/en/1.10/topics/db/sql/
However, I do not understand where the function:
def my_custom_sql(self):
that they are talking about in the last section is supposed to go to (views.py ?) and what is 'self' in that case, since my view is not defined as a class.
Thanks!