I have a table with users in HTML with id and name, by default when registering a person it comes with is_staff = False.
I want when I click the Authorize link change to is_staff = True, how do I do this in the view?
{% block content %}
<p>Usuários</p>
<table class="striped" id="cadastrados">
<thead>
<tr>
<th>Código</th>
<th>Nome</th>
<th>Telefone</th>
<th>Ramal</th>
<th>É staff?</th>
<th>Autorizar</th>
</tr>
</thead>
<tbody>
{% for item in lista_usuarios %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.first_name }}</td>
<td>{{ item.telefone }}</td>
<td>{{ item.ramal }}</td>
<td> {{ item.is_staff }} </td>
<td> <a href="{% url 'cadastro:autorizar' %}"></a> <a class="btn-floating btn-large red">
<i class="large material-icons">mode_edit</i></a> </td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}
views.py
def quantities(request, value=None):
if value == "2":
usuarios = Perfil.objects.filter(is_staff=False)
context = {'lista_usuarios': usuarios}
else:
usuarios = Perfil.objects.filter(is_staff=True)
context = {'lista_usuarios': usuarios}
return render(request, 'quantities.html', context)