In your admin definition, you can define a queryset()
method that returns the queryset for that model's admin. eg:
class MyModelAdmin(admin.ModelAdmin):
def queryset(self, request):
qs = super(MyModelAdmin, self).queryset(request)
return qs.filter(user=request.user)
Then only objects with user=request.user
will be visible in the admin.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…