old_contents: 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)
  
new_contents: 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)
  
subject: Use raw ID fields for users, organizations