I need to retrieve an optional number saved in DB , to a custom template tag i made . which to retrieve , a variable ( a photo ID ) included in this Gallery . within the gallery
You don't put the brackets around variables when you use them in template tags.
{% get_latest_photo photo.id %}