I finally got the monkey-patching method to work by doing the following.
You can add fields to the user class with the method add_to_class instead of inheriting the User class by doing the following in your models.py:
User.add_to_class('new_field', models.BooleanField(default=False))
Once that is done, in admin.py, modify the UserAdmin and add your new field
from django.contrib.auth.admin import UserAdminVoilĂ , with that done, you're new fields should show up in the auth user on the django admin page.
UserAdmin.list_display += ('new_field',)
UserAdmin.list_filter += ('new_field',)
UserAdmin.fieldsets[1][1]['fields'] = ('first_name','last_name','email','new_field')
No comments:
Post a Comment