Commits

Luke Plant committed 81e9e16

Performance fixes for admin

Comments (0)

Files changed (2)

cciw/cciwmain/admin.py

     filter_horizontal = ('leaders', 'admins')
     date_hierarchy = 'start_date'
 
+    def queryset(self, request):
+        return super(CampAdmin, self).queryset(request).select_related('site', 'chaplain')
+
 admin.site.register(Site, SiteAdmin)
 admin.site.register(Person, PersonAdmin)
 admin.site.register(Camp, CampAdmin)

cciw/sitecontent/admin.py

 from cciw.sitecontent.models import MenuLink, HtmlChunk
 from django.contrib import admin
 
+
 class MenuLinkAdmin(admin.ModelAdmin):
     list_display = ('title', 'url', 'listorder','visible','parent_item')
 
+    def queryset(self, *args):
+        return super(MenuLinkAdmin, self).queryset(*args).select_related('parent_item')
+
+
 class HtmlChunkAdmin(admin.ModelAdmin):
     list_display = ('name', 'page_title', 'menu_link')