Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django admin prefetch_related

from django.contrib import admin

class MyModelAdmin(admin.ModelAdmin):
    def get_queryset(self, request):
        queryset = super(MyModelAdmin, self).get_queryset(request)
        queryset = queryset.prefetch_related('user')
        return queryset
Source by www.darklaunch.com #
 
PREVIOUS NEXT
Tagged: #django #admin
ADD COMMENT
Topic
Name
2+8 =