You should use plonecli to make the add-on. It is possible to make the add-on manually (but don't do that)
When you use plonecli to make a (browser) view, it will make TWO files by default: view.py and template.pt. In view.py you add the code to get the related contents and you call this from template.pt:
SO, in view.py you have something like:
def getRelations(self):
// find all backlinks
return 'the result I found'