3 ms·
Creating the admin part for the new User model is quite a bit of work. You will have to not only create a new ModelAdmin but also create new forms and/or views
by arocks 14y ago
Creating the admin part for the new User model is quite a bit of work. You will have to not only create a new ModelAdmin but also create new forms and/or views for all the CRUD operations.
- freakboy3742 14y agoThe amount of work involved is entirely dependent on how different your User model is. If you've got a model where the username is even similar to the normal Django User, you don't need to redefine anything - you can use the existing forms and ModelAdmin. If your model uses a different identifer field (e.g., email, rather than username), or doesn't share common fields with the default User, then yes, you'll need to redefine some forms. That shouldn't be too surprising, though -- if you've created a model that's nothing like Django's default User model, it shouldn't be surprising that you need to do some work to support it. However, you shouldn't need to redefine any views, and the forms that need redefinition are fairly simple -- a fully worked example is in the docs. On top of that, those forms and ModelAdmin definitions should be extremely reusable - it will be easy to package an "email-based" user model for reuse between projects.
- arocks 14y agoI was trying to extend AbstractUser with just one extra field and realised that it was not easy. But then you are correct that it is how rest of Django works.