from depot.models import Depot, Organization
from django.contrib import admin


class OrganizationAdmin(admin.ModelAdmin):

    def get_queryset(self, request):
        """
        Superusers can see every organization.
        Other users can see only the organizations which they manage.
        """
        qs = super().get_queryset(request)

        if request.user.is_superuser:
            return qs

        return qs.filter(managers__id=request.user.id)

    def has_add_permission(self, request):
        """
        Only superusers can create new organizations.
        """
        if request.user.is_superuser:
            return True

        return False

    def has_change_permission(self, request, obj=None):
        """
        Only superusers and organization managers can change an organization.
        """
        if not obj:
            return True

        if request.user.is_superuser:
            return True

        if obj.managers.filter(id=request.user.id).exists():
            return True

        return False

    def has_delete_permission(self, request, obj=None):
        """
        Organizations can't be deleted.
        """
        return False

@@ -73,16 +73,135 @@
 admin%0A%0A%0A
+# show items in depot%0Aclass DepotInline(admin.TabularInline):%0A    model = Depot%0A    extra = 0%0A    can_delete = False%0A%0A%0A
 class Or
@@ -236,16 +236,45 @@
 dmin):%0A%0A
+    inlines = %5BDepotInline%5D%0A%0A
     def 

Add inline creation of depots from within admin organization view