I am developing a web based application in which i need to update the password and is_staff status of a user from Admin(template) page. To do this i created a template which are showing the list of all registered users. see the template:
{% for obj in users_list.object_list %}
<tr class="{% cycle 'odd' 'even' %}">
<td>{{obj}}</td>
<td><a href="{% url user_detail user.pk%}">{{obj.first_name}}</a></td>
<td>{{obj.last_name}}</td>
<td>{{obj.email}}</td>
<td>{{obj.is_staff}}</td>
The above code showing the list of all users includes their Full name, Email and is_staff status. What i want, when admin will click on the user name (i uses the href attributes). It will get the option to update the password and is_staff status for a clicked user at open page.
To do this i am not able to find out how to pass the id of user in following line. I tried with user.pk but it always given 1 to me. May be it is returning the current loginned user id but the loginned user is super user also:
<td><a href="{% url user_detail user.pk%}">{{obj.first_name}}</a></td>
The reference to the user is
obj, notuser. Soobj.pkshould work.