Dev Utils

Developer

class djem.utils.dev.Developer(**user_lookup_kwargs)[source]

Designed for use within the Django shell to aid developers in performing regular operations used for testing and debugging, primarily regarding accessing the developer’s user record and altering aspects of that record

awesome = {'is_staff': True, 'is_superuser': True}
boring = {'is_staff': False, 'is_superuser': False}
user

The developer’s associated user model instance, as given by django.contrib.auth.get_user_model(), and looked up using the keyword arguments given to the constructor or defined by the DJEM_DEV_USER setting.

be_awesome()[source]

Assign user the attributes defined in awesome. Designed to allow developers to adopt/restore relevant elevated privileges.

be_boring()[source]

Assign user the attributes defined in boring. Designed to allow developers to adopt relevant reduced privileges for testing.

no_super()[source]

Set the is_superuser=False flag on user.

no_staff()[source]

Set the is_staff=False flag on user.

add_permissions(*permissions)[source]

Assign user the given permissions (by codename).

remove_permissions(*permissions)[source]

Remove the given permissions (by codename) from user.