name class an id, a first & a last attributes
In my view.py, I fetch a name object from the database and pass it into the index.html template.
In my templagetags/my_tags.py
, I have a filter my_private_tag(value, arg)
that takes value and an arg. It appends the arg to the value and returns the result.
def my_private_tag(value, arg):
return value + ' ' + arg
In my index.html tag I need to do the following.
{% if name %}
# to display
# John says hello
{{name.first | my_private_tag:"says hello"}
# Johns student id = id_value
{{name.first | my_private_tag:"????????"}
# Johns student id = id_value, lastname = lastname_value
{{name.first | my_private_tag:"????????"}
{% endif %}
Where:
id_value = name.id & lastname_value = name.last
Please fill in the ???????? if you can.