Managers

Return to API Reference

UserenaManager

class userena.managers.UserenaManager(*args, **kwargs)

Extra functionality for the Userena model.

activate_user(activation_key)

Activate an User by supplying a valid activation_key.

If the key is valid and an user is found, activates the user and return it. Also sends the activation_complete signal.

Parameters

activation_key – String containing the secret nonce for a valid activation.

Returns

The newly activated User or False if not successful.

check_expired_activation(activation_key)

Check if activation_key is still valid.

Raises a self.model.DoesNotExist exception if key is not present or

activation_key is not a valid string

Parameters

activation_key – String containing the secret nonce for a valid activation.

Returns

True if the ket has expired, False if still valid.

check_permissions()

Checks that all permissions are set correctly for the users.

Returns

A set of users whose permissions was wrong.

confirm_email(confirmation_key)

Confirm an email address by checking a confirmation_key.

A valid confirmation_key will set the newly wanted e-mail address as the current e-mail address. Returns the user after success or False when the confirmation key is invalid. Also sends the confirmation_complete signal.

Parameters

confirmation_key – String containing the secret nonce that is used for verification.

Returns

The verified User or False if not successful.

create_user(username, email, password, active=False, send_email=True)

A simple wrapper that creates a new User.

Parameters
  • username – String containing the username of the new user.

  • email – String containing the email address of the new user.

  • password – String containing the password for the new user.

  • active – Boolean that defines if the user requires activation by clicking on a link in an e-mail. Defaults to False.

  • send_email – Boolean that defines if the user should be sent an email. You could set this to False when you want to create a user in your own code, but don’t want the user to activate through email.

Returns

User instance representing the new user.

create_userena_profile(user)

Creates an UserenaSignup instance for this user.

Parameters

user – Django User instance.

Returns

The newly created UserenaSignup instance.

delete_expired_users()

Checks for expired users and delete’s the User associated with it. Skips if the user is_staff.

Returns

A list containing the deleted users.

reissue_activation(activation_key)

Creates a new activation_key resetting activation timeframe when users let the previous key expire.

Parameters

activation_key – String containing the secret nonce activation key.

UserenaBaseProfileManager

class userena.managers.UserenaBaseProfileManager(*args, **kwargs)

Manager for UserenaProfile

get_visible_profiles(user=None)

Returns all the visible profiles available to this user.

For now keeps it simple by just applying the cases when a user is not active, a user has it’s profile closed to everyone or a user only allows registered users to view their profile.

Parameters

user – A Django User instance.

Returns

All profiles that are visible to this user.