Commit 4780f0f2 authored by David Haynes's avatar David Haynes
Browse files

Associate RegisteredUser with User

- a registered user is displayed inline with user since it is only a wrapper class
- comments added as well for added usability
parent af01c202
# Django Imports
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
# App Imports
from go.models import URL, RegisteredUser
# Define what attributes display in the URL Admin
class URLAdmin(admin.ModelAdmin):
list_display = ("target", "short", "owner", "clicks", "date_created", "expires")
# Define an inline admin descriptor for User model
class RegisteredUserInline(admin.StackedInline):
model = RegisteredUser
can_delete = False
class RegisteredUserAdmin(admin.ModelAdmin):
list_display = ("full_name", "organization", "approved")
# Define a new User admin
class UserAdmin(UserAdmin):
inlines = (RegisteredUserInline, )
# Register URLAdmin and modify User to use new UserAdmin
admin.site.register(URL, URLAdmin)
admin.site.register(RegisteredUser, RegisteredUserAdmin)
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment