User

Change Password

Locate the user (as we do in the previous snippet), then:

user.set_password('password')
user.save()

Groups

Restricting Access by Group in Django:

u.groups.filter(name='Student').count() == 0

Note: In this sample, u is a user object.