Skip to content

Commit

Permalink
Override get_queryset in django.contrib.admin.ModelAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
nnsnodnb committed Aug 9, 2019
1 parent 60a3734 commit 83bf580
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions storekit/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class ReceiptAdmin(admin.ModelAdmin):
'version_external_identifier', 'receipt_creation_date', 'request_date', 'original_purchase_date', 'in_app'
)

def get_queryset(self, request):
return super().get_queryset(request).select_related('in_app')


admin.site.register(Receipt, ReceiptAdmin)

Expand All @@ -34,5 +37,8 @@ class ResponseAdmin(admin.ModelAdmin):
list_display = ('status', 'environment', 'receipt')
list_display_links = ('status', 'environment', 'receipt')

def get_queryset(self, request):
return super().get_queryset(request).select_realated('receipt')


admin.site.register(Response, ResponseAdmin)

0 comments on commit 83bf580

Please sign in to comment.