title: Passing object as kwargs to URL tag in template?
body: <p>Let's say I have a model like the following</p>
  <pre class="lang-py prettyprint-override"><code>from django.db import models
  class Person(models.Model):
      first_name = models.CharField(max_length=36)
      last_name = models.CharField(max_length=36)
  </code></pre>
  <p>and I have in <code>urls.py</code> a URL like</p>
  <pre class="lang-py prettyprint-override"><code>path(r'profile/&lt;str:first_name&gt;/&lt;str:last_name&gt;/', ..., name='profile')
  </code></pre>
  <p>In the template, if there's a variable <code>person</code> I could get their profile url by typing <code>{% url &quot;profile&quot; person.first_name person.last_name %}</code>.</p>
  <p>However, I would really prefer to not repeat myself and do something more along the lines of <code>{% url &quot;profile&quot; **person %}</code> --- that's not a valid syntax but the point is I'd like to use the attributes on person as the arguments to the URL tag. That way, if I ever change the URL pattern to use, say, <code>middle_name</code> as well, I don't need to edit the template again.</p>
  <p>Is there a (preferably built-in, but custom tags okay too) way to do this? I've spent a while on google with queries like &quot;django url template tag kwargs&quot; but haven't found anything. (And I want to avoid changing the URL itself since it is exposed to end user.)</p>