{% if linkpk %} {% url link pk=linkpk as the_url %} {% else %} {% url link as the_url %} {% endif %}