indexview.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. ============================================
  2. Customising ``IndexView`` - the listing view
  3. ============================================
  4. For the sake of consistency, this section of the docs will refer to the listing
  5. view as ``IndexView``, because that is the view class that does all the heavy
  6. lifting.
  7. You can use the following attributes and methods on the ``ModelAdmin`` class to
  8. alter how your model data is treated and represented by the ``IndexView``.
  9. .. contents::
  10. :local:
  11. :depth: 1
  12. .. _modeladmin_list_display:
  13. ---------------------------
  14. ``ModelAdmin.list_display``
  15. ---------------------------
  16. **Expected value**: A list or tuple, where each item is the name of a field or
  17. single-argument callable on your model, or a similarly simple method defined
  18. on the ``ModelAdmin`` class itself.
  19. Default value: ``('__str__',)``
  20. Set ``list_display`` to control which fields are displayed in the ``IndexView``
  21. for your model.
  22. You have three possible values that can be used in ``list_display``:
  23. - A field of the model. For example:
  24. .. code-block:: python
  25. from wagtail.contrib.modeladmin.options import ModelAdmin
  26. from .models import Person
  27. class PersonAdmin(ModelAdmin):
  28. model = Person
  29. list_display = ('first_name', 'last_name')
  30. - The name of a custom method on your ``ModelAdmin`` class, that accepts a
  31. single parameter for the model instance. For example:
  32. .. code-block:: python
  33. from wagtail.contrib.modeladmin.options import ModelAdmin
  34. from .models import Person
  35. class PersonAdmin(ModelAdmin):
  36. model = Person
  37. list_display = ('upper_case_name',)
  38. def upper_case_name(self, obj):
  39. return ("%s %s" % (obj.first_name, obj.last_name)).upper()
  40. upper_case_name.short_description = 'Name'
  41. - The name of a method on your ``Model`` class that accepts only ``self`` as
  42. an argument. For example:
  43. .. code-block:: python
  44. from django.db import models
  45. from wagtail.contrib.modeladmin.options import ModelAdmin
  46. class Person(models.Model):
  47. name = models.CharField(max_length=50)
  48. birthday = models.DateField()
  49. def decade_born_in(self):
  50. return self.birthday.strftime('%Y')[:3] + "0's"
  51. decade_born_in.short_description = 'Birth decade'
  52. class PersonAdmin(ModelAdmin):
  53. model = Person
  54. list_display = ('name', 'decade_born_in')
  55. A few special cases to note about ``list_display``:
  56. - If the field is a ``ForeignKey``, Django will display the output of
  57. ``__str__()`` of the related object.
  58. - If the string provided is a method of the model or ``ModelAdmin`` class,
  59. Django will HTML-escape the output by default. To escape user input and
  60. allow your own unescaped tags, use ``format_html()``. For example:
  61. .. code-block:: python
  62. from django.db import models
  63. from django.utils.html import format_html
  64. from wagtail.contrib.modeladmin.options import ModelAdmin
  65. class Person(models.Model):
  66. first_name = models.CharField(max_length=50)
  67. last_name = models.CharField(max_length=50)
  68. color_code = models.CharField(max_length=6)
  69. def colored_name(self):
  70. return format_html(
  71. '<span style="color: #{};">{} {}</span>',
  72. self.color_code,
  73. self.first_name,
  74. self.last_name,
  75. )
  76. class PersonAdmin(ModelAdmin):
  77. model = Person
  78. list_display = ('first_name', 'last_name', 'colored_name')
  79. - If the value of a field is ``None``, an empty string, or an iterable
  80. without elements, Wagtail will display a dash (-) for that column. You can
  81. override this by setting ``empty_value_display`` on your ``ModelAdmin``
  82. class. For example:
  83. .. code-block:: python
  84. from wagtail.contrib.modeladmin.options import ModelAdmin
  85. class PersonAdmin(ModelAdmin):
  86. empty_value_display = 'N/A'
  87. ...
  88. Or, if you'd like to change the value used depending on the field, you can
  89. override ``ModelAdmin``'s ``get_empty_value_display()`` method, like so:
  90. .. code-block:: python
  91. from django.db import models
  92. from wagtail.contrib.modeladmin.options import ModelAdmin
  93. class Person(models.Model):
  94. name = models.CharField(max_length=100)
  95. nickname = models.CharField(blank=True, max_length=100)
  96. likes_cat_gifs = models.NullBooleanField()
  97. class PersonAdmin(ModelAdmin):
  98. model = Person
  99. list_display = ('name', 'nickname', 'likes_cat_gifs')
  100. def get_empty_value_display(self, field_name=None):
  101. if field_name == 'nickname':
  102. return 'None given'
  103. if field_name == 'likes_cat_gifs':
  104. return 'Unanswered'
  105. return super().get_empty_value_display(field_name)
  106. The ``__str__()`` method is just as valid
  107. in ``list_display`` as any other model method, so it’s perfectly OK to do
  108. this:
  109. .. code-block:: python
  110. list_display = ('__str__', 'some_other_field')
  111. By default, the ability to sort results by an item in ``list_display`` is
  112. only offered when it's a field that has an actual database value (because
  113. sorting is done at the database level). However, if the output of the
  114. method is representative of a database field, you can indicate this fact by
  115. setting the ``admin_order_field`` attribute on that method, like so:
  116. .. code-block:: python
  117. from django.db import models
  118. from django.utils.html import format_html
  119. from wagtail.contrib.modeladmin.options import ModelAdmin
  120. class Person(models.Model):
  121. first_name = models.CharField(max_length=50)
  122. last_name = models.CharField(max_length=50)
  123. color_code = models.CharField(max_length=6)
  124. def colored_first_name(self):
  125. return format_html(
  126. '<span style="color: #{};">{}</span>',
  127. self.color_code,
  128. self.first_name,
  129. )
  130. colored_first_name.admin_order_field = 'first_name'
  131. class PersonAdmin(ModelAdmin):
  132. model = Person
  133. list_display = ('colored_first_name', 'last_name')
  134. The above will tell Wagtail to order by the ``first_name`` field when
  135. trying to sort by ``colored_first_name`` in the index view.
  136. To indicate descending order with ``admin_order_field`` you can use a
  137. hyphen prefix on the field name. Using the above example, this would look
  138. like:
  139. .. code-block:: python
  140. colored_first_name.admin_order_field = '-first_name'
  141. ``admin_order_field`` supports query lookups to sort by values on related
  142. models, too. This example includes an “author first name” column in the
  143. list display and allows sorting it by first name:
  144. .. code-block:: python
  145. from django.db import models
  146. class Blog(models.Model):
  147. title = models.CharField(max_length=255)
  148. author = models.ForeignKey(Person, on_delete=models.CASCADE)
  149. def author_first_name(self, obj):
  150. return obj.author.first_name
  151. author_first_name.admin_order_field = 'author__first_name'
  152. - Elements of ``list_display`` can also be properties. Please note however,
  153. that due to the way properties work in Python, setting
  154. ``short_description`` on a property is only possible when using the
  155. ``property()`` function and **not** with the ``@property`` decorator.
  156. For example:
  157. .. code-block:: python
  158. from django.db import models
  159. from wagtail.contrib.modeladmin.options import ModelAdmin
  160. class Person(models.Model):
  161. first_name = models.CharField(max_length=50)
  162. last_name = models.CharField(max_length=50)
  163. def full_name_property(self):
  164. return self.first_name + ' ' + self.last_name
  165. full_name_property.short_description = "Full name of the person"
  166. full_name = property(full_name_property)
  167. class PersonAdmin(ModelAdmin):
  168. list_display = ('full_name',)
  169. .. _modeladmin_list_filter:
  170. ---------------------------
  171. ``ModelAdmin.list_filter``
  172. ---------------------------
  173. **Expected value**: A list or tuple, where each item is the name of model field
  174. of type ``BooleanField``, ``CharField``, ``DateField``, ``DateTimeField``,
  175. ``IntegerField`` or ``ForeignKey``.
  176. Set ``list_filter`` to activate filters in the right sidebar of the list page
  177. for your model. For example:
  178. .. code-block:: python
  179. class PersonAdmin(ModelAdmin):
  180. list_filter = ('is_staff', 'company')
  181. .. _modeladmin_search_fields:
  182. ----------------------------
  183. ``ModelAdmin.search_fields``
  184. ----------------------------
  185. **Expected value**: A list or tuple, where each item is the name of a model
  186. field of type ``CharField``, ``TextField``, ``RichTextField`` or
  187. ``StreamField``.
  188. Set ``search_fields`` to enable a search box at the top of the index page
  189. for your model. You should add names of any fields on the model that should
  190. be searched whenever somebody submits a search query using the search box.
  191. Searching is handled via Django's QuerySet API by default,
  192. see `ModelAdmin.search_handler_class`_ about changing this behaviour.
  193. This means by default it will work for all models, whatever search backend
  194. your project is using, and without any additional setup or configuration.
  195. .. _modeladmin_search_handler_class:
  196. -----------------------------------
  197. ``ModelAdmin.search_handler_class``
  198. -----------------------------------
  199. **Expected value**: A subclass of
  200. ``wagtail.contrib.modeladmin.helpers.search.BaseSearchHandler``
  201. The default value is ``DjangoORMSearchHandler``, which uses the Django ORM to
  202. perform lookups on the fields specified by ``search_fields``.
  203. If you would prefer to use the built-in Wagtail search backend to search your
  204. models, you can use the ``WagtailBackendSearchHandler`` class instead. For
  205. example:
  206. .. code-block:: python
  207. from wagtail.contrib.modeladmin.helpers import WagtailBackendSearchHandler
  208. from .models import Person
  209. class PersonAdmin(ModelAdmin):
  210. model = Person
  211. search_handler_class = WagtailBackendSearchHandler
  212. Extra considerations when using ``WagtailBackendSearchHandler``
  213. ===============================================================
  214. ``ModelAdmin.search_fields`` is used differently
  215. ------------------------------------------------
  216. The value of ``search_fields`` is passed to the underlying search backend to
  217. limit the fields used when matching. Each item in the list must be indexed
  218. on your model using :ref:`wagtailsearch_index_searchfield`.
  219. To allow matching on **any** indexed field, set the ``search_fields`` attribute
  220. on your ``ModelAdmin`` class to ``None``, or remove it completely.
  221. Indexing extra fields using ``index.FilterField``
  222. -------------------------------------------------
  223. The underlying search backend must be able to interpret all of the fields and
  224. relationships used in the queryset created by ``IndexView``, including those
  225. used in ``prefetch()`` or ``select_related()`` queryset methods, or used in
  226. ``list_display``, ``list_filter`` or ``ordering``.
  227. Be sure to test things thoroughly in a development environment (ideally
  228. using the same search backend as you use in production). Wagtail will raise
  229. an ``IndexError`` if the backend encounters something it does not understand,
  230. and will tell you what you need to change.
  231. .. _modeladmin_extra_search_kwargs:
  232. ----------------------------------
  233. ``ModelAdmin.extra_search_kwargs``
  234. ----------------------------------
  235. **Expected value**: A dictionary of keyword arguments that will be passed on to the ``search()`` method of
  236. ``search_handler_class``.
  237. For example, to override the ``WagtailBackendSearchHandler`` default operator you could do the following:
  238. .. code-block:: python
  239. from wagtail.contrib.modeladmin.helpers import WagtailBackendSearchHandler
  240. from wagtail.search.utils import OR
  241. from .models import IndexedModel
  242. class DemoAdmin(ModelAdmin):
  243. model = IndexedModel
  244. search_handler_class = WagtailBackendSearchHandler
  245. extra_search_kwargs = {'operator': OR}
  246. .. _modeladmin_ordering:
  247. ---------------------------
  248. ``ModelAdmin.ordering``
  249. ---------------------------
  250. **Expected value**: A list or tuple in the same format as a model’s
  251. :attr:`~django.db.models.Options.ordering` parameter.
  252. Set ``ordering`` to specify the default ordering of objects when listed by
  253. IndexView. If not provided, the model’s default ordering will be respected.
  254. If you need to specify a dynamic order (for example, depending on user or
  255. language) you can override the ``get_ordering()`` method instead.
  256. .. _modeladmin_list_per_page:
  257. ----------------------------
  258. ``ModelAdmin.list_per_page``
  259. ----------------------------
  260. **Expected value**: A positive integer
  261. Set ``list_per_page`` to control how many items appear on each paginated page
  262. of the index view. By default, this is set to ``100``.
  263. .. _modeladmin_get_queryset:
  264. -----------------------------
  265. ``ModelAdmin.get_queryset()``
  266. -----------------------------
  267. **Must return**: A QuerySet
  268. The ``get_queryset`` method returns the 'base' QuerySet for your model, to
  269. which any filters and search queries are applied. By default, the ``all()``
  270. method of your model's default manager is used. But, if for any reason you
  271. only want a certain sub-set of objects to appear in the IndexView listing,
  272. overriding the ``get_queryset`` method on your ``ModelAdmin`` class can help
  273. you with that. The method takes an ``HttpRequest`` object as a parameter, so
  274. limiting objects by the current logged-in user is possible.
  275. For example:
  276. .. code-block:: python
  277. from django.db import models
  278. from wagtail.contrib.modeladmin.options import ModelAdmin
  279. class Person(models.Model):
  280. first_name = models.CharField(max_length=50)
  281. last_name = models.CharField(max_length=50)
  282. managed_by = models.ForeignKey(`auth.User`, on_delete=models.CASCADE)
  283. class PersonAdmin(ModelAdmin):
  284. model = Person
  285. list_display = ('first_name', 'last_name')
  286. def get_queryset(self, request):
  287. qs = super().get_queryset(request)
  288. # Only show people managed by the current user
  289. return qs.filter(managed_by=request.user)
  290. .. _modeladmin_get_extra_attrs_for_row:
  291. ----------------------------------------------------
  292. ``ModelAdmin.get_extra_attrs_for_row()``
  293. ----------------------------------------------------
  294. **Must return**: A dictionary
  295. The ``get_extra_attrs_for_row`` method allows you to add html attributes to
  296. the opening ``<tr>`` tag for each result, in addition to the ``data-object_pk`` and
  297. ``class`` attributes already added by the ``result_row_display`` template tag.
  298. If you want to add additional CSS classes, simply provide those class names
  299. as a string value using the ``'class'`` key, and the ``odd``/``even`` will be appended
  300. to your custom class names when rendering.
  301. For example, if you wanted to add some additional class names based on field
  302. values, you could do something like:
  303. .. code-block:: python
  304. from decimal import Decimal
  305. from django.db import models
  306. from wagtail.contrib.modeladmin.options import ModelAdmin
  307. class BankAccount(models.Model):
  308. name = models.CharField(max_length=50)
  309. account_number = models.CharField(max_length=50)
  310. balance = models.DecimalField(max_digits=5, num_places=2)
  311. class BankAccountAdmin(ModelAdmin):
  312. list_display = ('name', 'account_number', 'balance')
  313. def get_extra_attrs_for_row(self, obj, context):
  314. if obj.balance < Decimal('0.00'):
  315. classname = 'balance-negative'
  316. else:
  317. classname = 'balance-positive'
  318. return {
  319. 'class': classname,
  320. }
  321. .. _modeladmin_get_extra_class_names_for_field_col:
  322. ----------------------------------------------------
  323. ``ModelAdmin.get_extra_class_names_for_field_col()``
  324. ----------------------------------------------------
  325. **Must return**: A list
  326. The ``get_extra_class_names_for_field_col`` method allows you to add additional
  327. CSS class names to any of the columns defined by ``list_display`` for your
  328. model. The method takes two parameters:
  329. - ``obj``: the object being represented by the current row
  330. - ``field_name``: the item from ``list_display`` being represented by the
  331. current column
  332. For example, if you'd like to apply some conditional formatting to a cell
  333. depending on the row's value, you could do something like:
  334. .. code-block:: python
  335. from decimal import Decimal
  336. from django.db import models
  337. from wagtail.contrib.modeladmin.options import ModelAdmin
  338. class BankAccount(models.Model):
  339. name = models.CharField(max_length=50)
  340. account_number = models.CharField(max_length=50)
  341. balance = models.DecimalField(max_digits=5, num_places=2)
  342. class BankAccountAdmin(ModelAdmin):
  343. list_display = ('name', 'account_number', 'balance')
  344. def get_extra_class_names_for_field_col(self, obj, field_name):
  345. field_name == 'balance':
  346. if balance <= Decimal('-100.00'):
  347. return ['brand-danger']
  348. if balance <= Decimal('-0.00'):
  349. return ['brand-warning']
  350. if balance <= Decimal('-50.00'):
  351. return ['brand-info']
  352. else:
  353. return ['brand-success']
  354. return []
  355. .. _modeladmin_get_extra_attrs_for_field_col:
  356. ----------------------------------------------------
  357. ``ModelAdmin.get_extra_attrs_for_field_col()``
  358. ----------------------------------------------------
  359. **Must return**: A dictionary
  360. The ``get_extra_attrs_for_field_col`` method allows you to add additional HTML
  361. attributes to any of the columns defined in ``list_display``. Like the
  362. ``get_extra_class_names_for_field_col`` method above, this method takes two
  363. parameters:
  364. - ``obj``: the object being represented by the current row
  365. - ``field_name``: the item from ``list_display`` being represented by the
  366. current column
  367. For example, you might like to add some tooltip text to a certain column, to
  368. help give the value more context:
  369. .. code-block:: python
  370. from django.db import models
  371. from wagtail.contrib.modeladmin.options import ModelAdmin
  372. class Person(models.Model):
  373. name = models.CharField(max_length=100)
  374. likes_cat_gifs = models.NullBooleanField()
  375. class PersonAdmin(ModelAdmin):
  376. model = Person
  377. list_display = ('name', 'likes_cat_gifs')
  378. def get_extra_attrs_for_field_col(self, obj, field_name=None):
  379. attrs = super().get_extra_attrs_for_field_col(obj, field_name)
  380. if field_name == 'likes_cat_gifs' and obj.likes_cat_gifs is None:
  381. attrs.update({
  382. 'title': (
  383. 'The person was shown several cat gifs, but failed to '
  384. 'indicate a preference.'
  385. ),
  386. })
  387. return attrs
  388. Or you might like to add one or more data attributes to help implement some
  389. kind of interactivity using JavaScript:
  390. .. code-block:: python
  391. from django.db import models
  392. from wagtail.contrib.modeladmin.options import ModelAdmin
  393. class Event(models.Model):
  394. title = models.CharField(max_length=255)
  395. start_date = models.DateField()
  396. end_date = models.DateField()
  397. start_time = models.TimeField()
  398. end_time = models.TimeField()
  399. class EventAdmin(ModelAdmin):
  400. model = Event
  401. list_display = ('title', 'start_date', 'end_date')
  402. def get_extra_attrs_for_field_col(self, obj, field_name=None):
  403. attrs = super().get_extra_attrs_for_field_col(obj, field_name)
  404. if field_name == 'start_date':
  405. # Add the start time as data to the 'start_date' cell
  406. attrs.update({ 'data-time': obj.start_time.strftime('%H:%M') })
  407. elif field_name == 'end_date':
  408. # Add the end time as data to the 'end_date' cell
  409. attrs.update({ 'data-time': obj.end_time.strftime('%H:%M') })
  410. return attrs
  411. .. _modeladmin_thumbnailmixin:
  412. ----------------------------------------------------
  413. ``wagtail.contrib.modeladmin.mixins.ThumbnailMixin``
  414. ----------------------------------------------------
  415. If you're using ``wagtailimages.Image`` to define an image for each item in
  416. your model, ``ThumbnailMixin`` can help you add thumbnail versions of that
  417. image to each row in ``IndexView``. To use it, simply extend ``ThumbnailMixin``
  418. as well as ``ModelAdmin`` when defining your ``ModelAdmin`` class, and
  419. change a few attributes to change the thumbnail to your liking, like so:
  420. .. code-block:: python
  421. from django.db import models
  422. from wagtail.contrib.modeladmin.mixins import ThumbnailMixin
  423. from wagtail.contrib.modeladmin.options import ModelAdmin
  424. class Person(models.Model):
  425. name = models.CharField(max_length=255)
  426. avatar = models.ForeignKey('wagtailimages.Image', on_delete=models.SET_NULL, null=True)
  427. likes_cat_gifs = models.NullBooleanField()
  428. class PersonAdmin(ThumbnailMixin, ModelAdmin):
  429. # Add 'admin_thumb' to list_display, where you want the thumbnail to appear
  430. list_display = ('admin_thumb', 'name', 'likes_cat_gifs')
  431. # Optionally tell IndexView to add buttons to a different column (if the
  432. # first column contains the thumbnail, the buttons are likely better off
  433. # displayed elsewhere)
  434. list_display_add_buttons = 'name'
  435. """
  436. Set 'thumb_image_field_name' to the name of the ForeignKey field that
  437. links to 'wagtailimages.Image'
  438. """
  439. thumb_image_field_name = 'avatar'
  440. # Optionally override the filter spec used to create each thumb
  441. thumb_image_filter_spec = 'fill-100x100' # this is the default
  442. # Optionally override the 'width' attribute value added to each img tag
  443. thumb_image_width = 50 # this is the default
  444. # Optionally override the class name added to each img tag
  445. thumb_classname = 'admin-thumb' # this is the default
  446. # Optionally override the text that appears in the column header
  447. thumb_col_header_text = 'image' # this is the default
  448. # Optionally specify a fallback image to be used when the object doesn't
  449. # have an image set, or the image has been deleted. It can an image from
  450. # your static files folder, or an external URL.
  451. thumb_default = 'https://lorempixel.com/100/100'
  452. .. _modeladmin_list_display_add_buttons:
  453. ---------------------------------------
  454. ``ModelAdmin.list_display_add_buttons``
  455. ---------------------------------------
  456. **Expected value**: A string matching one of the items in ``list_display``.
  457. If for any reason you'd like to change which column the action buttons appear
  458. in for each row, you can specify a different column using
  459. ``list_display_add_buttons`` on your ``ModelAdmin`` class. The value must
  460. match one of the items your class's ``list_display`` attribute. By default,
  461. buttons are added to the first column of each row.
  462. See the ``ThumbnailMixin`` example above to see how
  463. ``list_display_add_buttons`` can be used.
  464. .. _modeladmin_index_view_extra_css:
  465. -----------------------------------
  466. ``ModelAdmin.index_view_extra_css``
  467. -----------------------------------
  468. **Expected value**: A list of path names of additional stylesheets to be added
  469. to the ``IndexView``
  470. See the following part of the docs to find out more:
  471. :ref:`modeladmin_adding_css_and_js`
  472. .. _modeladmin_index_view_extra_js:
  473. -----------------------------------
  474. ``ModelAdmin.index_view_extra_js``
  475. -----------------------------------
  476. **Expected value**: A list of path names of additional js files to be added
  477. to the ``IndexView``
  478. See the following part of the docs to find out more:
  479. :ref:`modeladmin_adding_css_and_js`
  480. .. _modeladmin_index_template_name:
  481. ---------------------------------------
  482. ``ModelAdmin.index_template_name``
  483. ---------------------------------------
  484. **Expected value**: The path to a custom template to use for ``IndexView``
  485. See the following part of the docs to find out more:
  486. :ref:`modeladmin_overriding_templates`
  487. .. _modeladmin_index_view_class:
  488. ---------------------------------------
  489. ``ModelAdmin.index_view_class``
  490. ---------------------------------------
  491. **Expected value**: A custom ``view`` class to replace
  492. ``modeladmin.views.IndexView``
  493. See the following part of the docs to find out more:
  494. :ref:`modeladmin_overriding_views`