I have a rather large CMS with many modules and am regulating access with Django permissions. Each app has a UserProfile model with a User object as a ForeignKey. I want to be able to allow easy lookup and creation of UserProfile objects within each app. I wanted to use Inlines to do it like this (from project/app/admin.py):
class InlineModelForUser(admin.TabularInline):
model = User
extra=0
class UserSettings(admin.ModelAdmin):
search_fields = ['username', 'name']
readonly_fields = ['username','name', 'otherproperites']
inlines = [InlineModelForUser,]
admin.site.register(User, UserSettings)
Error returned is:"The model User is already registered". I understand why it's happening and I appreciate that I can probably implement the same functionality in a different way. What I am trying to achieve is segregate the editing of the base object (User) and the app profile object attached. I see of course that I can make an autocomplete field in the CreateView for the UserProfile, but sometimes you need to provide different filtering tools for each app (filtering for/against User properties) AND the need to hide some user information from the users of each app.
Basically: How can I within the django.contrib.admin build several views against the same model and register it with admin.site.register?