How to override Django Admin
<p>I have two models Restaurant and Details. The superuser assigns each restaurant a user.When that user logs into admin i want only those Details associated with that user's Restaurant to be shown,and he should be able to edit them as well.
I tried to override admin's queryset function but to no success.Any help would be appreciated. This is what i did so far</p>

<p>I am just a beginner in Django.</p>

<pre><code>class RestaurantAdmin(admin.ModelAdmin):
    model = Details

    def save_model(self, request, obj, form, change):
        obj.user = request.user
        super(RestaurantAdmin, self).save_model(request, obj, form, change)

    def queryset(self, request):
        print(request.user)
        qs = super(ResaturantAdmin, self).queryset(request)
        # If super-user, show all comments
        if request.user.is_superuser:
          return qs
        return qs.filter(owner=request.user)




admin.site.register(Restaurant)
admin.site.register(Details,RestaurantAdmin)
</code></pre>

<p>The method you need to override is called <code>get_queryset</code>, not <code>queryset</code>.</p>

python django override admin