from django.contrib import admin

from organizations.models import (Organization, OrganizationUser,
        OrganizationOwner)


class OwnerInline(admin.StackedInline):
    model = OrganizationOwner
    raw_id_fields = ('organization_user',)


class OrganizationAdmin(admin.ModelAdmin):
    inlines = [OwnerInline]
    list_display = ['name', 'is_active']
    prepopulated_fields = {"slug": ("name",)}


class OrganizationUserAdmin(admin.ModelAdmin):
    list_display = ['user', 'organization', 'is_admin']
    raw_id_fields = ('user', 'organization')


class OrganizationOwnerAdmin(admin.ModelAdmin):
    raw_id_fields = ('organization_user', 'organization')


admin.site.register(Organization, OrganizationAdmin)
admin.site.register(OrganizationUser, OrganizationUserAdmin)
admin.site.register(OrganizationOwner, OrganizationOwnerAdmin)

from django.contrib import admin

from organizations.models import (Organization, OrganizationUser,
        OrganizationOwner)


class OwnerInline(admin.StackedInline):
    model = OrganizationOwner


class OrganizationAdmin(admin.ModelAdmin):
    inlines = [OwnerInline]
    list_display = ['name', 'is_active']
    prepopulated_fields = {"slug": ("name",)}


class OrganizationUserAdmin(admin.ModelAdmin):
    list_display = ['user', 'organization', 'is_admin']


class OrganizationOwnerAdmin(admin.ModelAdmin):
    pass


admin.site.register(Organization, OrganizationAdmin)
admin.site.register(OrganizationUser, OrganizationUserAdmin)
admin.site.register(OrganizationOwner, OrganizationOwnerAdmin)

--- 
+++ 
@@ -6,6 +6,7 @@
 
 class OwnerInline(admin.StackedInline):
     model = OrganizationOwner
+    raw_id_fields = ('organization_user',)
 
 
 class OrganizationAdmin(admin.ModelAdmin):
@@ -16,10 +17,11 @@
 
 class OrganizationUserAdmin(admin.ModelAdmin):
     list_display = ['user', 'organization', 'is_admin']
+    raw_id_fields = ('user', 'organization')
 
 
 class OrganizationOwnerAdmin(admin.ModelAdmin):
-    pass
+    raw_id_fields = ('organization_user', 'organization')
 
 
 admin.site.register(Organization, OrganizationAdmin)
Use raw ID fields for users, organizations

Avoids slowing down admin sites
