def my_get_query_set obj assert False class Gmstatistics models Model

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def my_get_query_set(obj):
assert False
class Gmstatistics(models.Model):
def changelist_view(self, request, extra_context=None): #переопределённая функция
from django.contrib.admin.views.main import ChangeList
old_func = ChangeList.get_query_set
ChangeList.get_query_set = my_get_query_set
super(Gmstatistics, self).changelist_view(self, request, extra_context=None) #родная должна выполнять
#ChangeList.my_get_query_set
#django.contrib.admin.views.main.ChangeList.get_query_set = old_func