Using Django's User model, I have the following template:
which shows the status of each account and the user may update them.
In the views:
accounts = request.POST.getlist('account') # This will get only the `checked` ones
for account in User.objects.filter(id__in=accounts):
if account is checked: # Only hypothetical ...
account.is_active = True
else:
account.is_active = False
account.save()
Questions:
-
How do I retrieve ALL checkboxes, checked or un-checked?
-
How can the retrieved list contains the status of each account, so that I can set the account's
is_activefield accordingly?
Aucun commentaire:
Enregistrer un commentaire