3👍
✅
Simply, you don’t.
You either adjust your url to have two capture groups (which would also require a slight change to the view)
url(r'(?P<first_name>\w+)_(?P<last_name>\w+)/$', view_name, name='url_name')
{% url 'urlname' user.firstname user.lastname %}
Or you just find a different url that suffices.
0👍
Please have a look at this thread. The good answer for you, assuming you’re using posititionnal arguments :
<a href="{% url 'urlname' parameter=user.firstname_user.lastname %}">The link</a>
Assuming your url conf is like so :
url(r'^urlname/(?P<parameter>(catching regexp))$',...)
- [Django]-Cannot upload an image in django using ImageField
- [Django]-OSError: [Errno 30] Read-only file system in Django on Heroku
- [Django]-DRYing up Django views request.user object
Source:stackexchange.com