From ca20e1490ef81bc98a2cf4eb8f835ed6082695fb Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 5 Jan 2022 21:02:12 +0530 Subject: [PATCH] Optimize MountainRange admin page load time --- app/admin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/admin.py b/app/admin.py index 514c072..f14cd25 100644 --- a/app/admin.py +++ b/app/admin.py @@ -132,11 +132,15 @@ class ResourceAdmin(admin.ModelAdmin): class RangeNameTranslationInline(admin.TabularInline): + autocomplete_fields = ['language_translation'] model = RangeNameTranslation + extra = 0 class RangeCountryInline(admin.TabularInline): + autocomplete_fields = ['country'] model = RangeCountry + extra = 0 class RangeAdmin(admin.ModelAdmin): @@ -179,6 +183,7 @@ class RangeAdmin(admin.ModelAdmin): ) list_display = ['range_name', 'mother_range', 'countries'] ordering = ['range_name'] + list_per_page = settings.ADMIN_LIST_PER_PAGE class PeopleOrganizationInline(admin.TabularInline): @@ -390,9 +395,9 @@ admin.site.register(Keyword, KeywordAdmin) # LU models -# admin.site.register(Country, CountriesAdmin) +admin.site.register(Country, CountriesAdmin) # admin.site.register(GMBA_SpeciesGroup, GMBA_SpeciesGroupAdmin) -# admin.site.register(Language, LanguageAdmin) +admin.site.register(Language, LanguageAdmin) # admin.site.register(PeopleStatus, PeopleStatusAdmin) # admin.site.register(RangeType, RangeTypeAdmin) # admin.site.register(RedListCategory, RedListCategoryAdmin)