First of all sorry if is there any question already please let me know that because I am fresh in this community
And thanks in advance for your valuable responses
In the below screenshot in Django admin, How can I override the select all 1005 with some custom number like select up to 500. As you know data_upload_max_number_fields has only a 1000 limit but I don’t want to increase the limit every time. Because it might be possible I have 100000 data then how much will increase the
data_upload_max_number_fields in Django settings. So is there any way that I can override this select all thing to less than the upload max field
for example, select all up to the first 500 data
I don’t know how to override the admin site but i can suggest you to use custom admin site filter to get the 500 id’s or more, for more about SimpleListFilter
lookup on to this ModelAdmin List Filters | Django documentation | Django , it might help.
admin.py
from django.contrib.admin import SimpleListFilter
class LessThanFiveFilter(admin.SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
title = "Custom Id"
# Parameter for the filter that will be used in the URL query.
parameter_name = 'filter-by-custom-id'
def lookups(self, request, model_admin):
"""
Returns a list of tuples. The first element in each
tuple is the coded value for the option that will
appear in the URL query. The second element is the
human-readable name for the option that will appear
in the right sidebar.
"""
return (('lt500', 'Less than 500'), ('gt500', 'Greater than 500'))
def queryset(self, request, queryset):
"""
Returns the filtered queryset based on the value
provided in the query string and retrievable via
`self.value()`.
"""
if self.value() == 'lt500':
return queryset.filter(id__lt=500)
if self.value() == 'gt500':
return queryset.filter(id__gt=500)
class ElectronicAdmin(admin.ModelAdmin):
list_filter = ( LessThanFiveFilter, 'type', 'seller_name')
in the right hand you can see the filters less than 500 and greater than 500, It might help what you want to achieve.