0

I need to access to queryset (including filtering, searching, etc)that is used to generate list in change_list.html

This is in django 2.2.1 and Python 3.6

admin.py

class CompanyAdmin(admin.ModelAdmin):
    list_display = ('name', 'city')
    list_display_links = ('name', 'city')
    list_filter = ('city', )
    search_fields = ('name', )

    change_list_template = 'admin/contacts/company/change_list.html'

admin.site.register(Company, CompanyAdmin)

change_list.html

{% extends "admin/change_list.html" %}

{% block content %}
{{ block.super }}
{% endblock %}

I would like to achieve somethig like this:

{% block content %}
{% for item in list %}
//and there iterate over all items of list 
{% endfor %}
{{ block.super }}
{% endblock %}

1 Answers1

0

answer is

{% block content %}
{% for item in cl.queryset %}
{{ item }} 
{% endfor %}
{{ block.super }}
{% endblock %}

it is list of queries