0

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!

doubleOK
  • 353
  • 6
  • 19

1 Answers1

0

That looks like a typo. There's no need for self there.

The code can go wherever you like, though.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895