Snippet List
I needed to create a feature for administrators to create accounts and email the *new account was created* email using a button. Remember to change the default template and subject to match your needs.
The code is directly taken from `django.contrib.auth.forms.PasswordResetForm.save()`.
Notice that the function raises `ValueError` if the user is missing an email address.
This is a username field that matches (and slightly tightens) the constraints on usernames in Django's `User` model.
Most people use RegexField, which is totally fine -- but it can't provide the fine-grained and user friendly messages that come from this field.
- fields
- forms
- user
- auth
- form
- field
- username
- users
- authorization
Based on [this snippet](http://www.djangosnippets.org/snippets/876/). More clean, with links to the related admin forms.
Nice example on customization of contributed django admin apps.
It adds the following to the user list interface: fields for is_superuser and is_staff, last login time; by default, short names of groups user is in (mousehover to see full names) It adds the following to the to group list interface: list of users in your groups.
To enable, just put it somewhere and import it from your main urls.py: import utils/admin_auth.py
- admin
- customization
- users
- groups
- roles
If you have a model with foreign key to User, you can use this manager to show (i.e. in admin interface) only objects, that are related to currently logged-in user. Superuser sees all objects, not only his.
Requires: [ThreadlocalsMiddleware](http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser)
- filter
- foreignkey
- user
- manager
- queryset
- owner
- users
- user-foreign-key
This is a simple fixture that is useful for many tests.
It contains the following users:
* admin
* staff
* user0
* user1
* user2
* user3
* inactive0
* inactive1
The password of every user is the same as his username, e.g.: admin/admin
- testing
- fixtures
- auth
- test
- fixture
- users
Add-on for auth app of newforms-admin branch, adding more information about users and their groups at user and group list in admin interface. Also, nice example on customization of contributed django admin apps.
It adds the following to the user list interface: fields for is_superuser and is_staff, last login time; by default, short names of groups user is in (mousehover to see full names)
It adds the following to the to group list interface: list of users in your groups.
To enable, just put it somewhere and import it from your main urls.py:
import useradmin
- admin
- newforms-admin
- customization
- users
- groups
- roles
- information
- nfa
- supervising
10 snippets posted so far.