Created
December 10, 2010 19:09
-
-
Save adamv/736636 to your computer and use it in GitHub Desktop.
admin.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import admin | |
| from django.contrib.auth.admin import UserAdmin | |
| from django.contrib.auth.forms import UserCreationForm, UserChangeForm | |
| from django.contrib.auth.models import Group, User | |
| # Override username field require email address | |
| class UserCreationForm2(UserCreationForm): | |
| email = forms.CharField(max_length=75, required=True) | |
| class UserChangeForm2(UserChangeForm): | |
| email = forms.CharField(max_length=75, required=True) | |
| class UserAdmin2(UserAdmin): | |
| form = UserChangeForm2 | |
| add_form = UserCreationForm2 | |
| admin.site.unregister(User) | |
| admin.site.register(User, UserAdmin2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment