Improving Usability with List Display Links and Pagination

The Django admin is one of the most powerful features of the framework, allowing developers and administrators to manage data efficiently without writing a single line of front-end code. However, as your application grows, so does the volume of data. Managing hundreds or thousands of records in the admin interface can become overwhelming without proper navigation and layout optimization.

Fortunately, Django provides several built-in features to improve admin usability — two of the most impactful are list_display_links and pagination via the list_per_page attribute. These features enhance navigation, clarity, and performance, making it easier to work with large datasets.

In this comprehensive guide, we’ll explore how these settings work, why they matter, and how to use them effectively to build a cleaner and more intuitive admin interface.

Table of Contents

  1. Introduction to Django Admin Usability
  2. Why List Display Optimization Matters
  3. What is list_display?
  4. Using list_display_links to Improve Navigation
  5. Setting list_display_links Correctly
  6. Controlling Pagination with list_per_page
  7. Why Pagination Improves Performance
  8. How to Customize Pagination
  9. Combining list_display_links and Pagination
  10. Practical Example: Book Management
  11. Handling Large Datasets in Admin
  12. Using list_max_show_all for Additional Control
  13. Best Practices for Choosing Display Links
  14. Integrating Search and Filters with Pagination
  15. Using ordering for Better Data Presentation
  16. Common Mistakes and How to Avoid Them
  17. Advanced Example with Multiple Links
  18. Improving User Experience for Non-Technical Admins
  19. Performance Considerations in Pagination
  20. Conclusion

1. Introduction to Django Admin Usability

The Django admin provides a default, ready-to-use interface for managing application data. It works out of the box, but by customizing it properly, you can make it much more user-friendly, especially for teams who rely on the admin interface daily.

Usability in admin isn’t just about how it looks — it’s about how quickly and accurately users can find and edit the records they need. Small optimizations such as selecting which fields are clickable and how many rows appear on a page can make a big difference.


2. Why List Display Optimization Matters

The change list view in the admin (the page that lists all objects of a model) is often where administrators spend most of their time. When your data volume is small, the default display works fine. But when your dataset grows to hundreds or thousands of entries, scrolling through long pages becomes inefficient and frustrating.

Optimizing list display helps to:

  • Improve navigation between list and edit pages.
  • Reduce cognitive load by showing only the most relevant fields.
  • Speed up page rendering by limiting rows per page.
  • Make bulk actions more manageable.
  • Ensure a clean, professional interface for non-technical users.

3. What is list_display?

The list_display attribute in Django’s ModelAdmin class controls which fields appear in the object list page of the admin interface.

For example:

from django.contrib import admin
from .models import Book

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status', 'published_date')
admin.site.register(Book, BookAdmin)

When you open the admin page for Book, you’ll see a table with columns for title, author, status, and published_date.

By default, the first field in list_display becomes the link to the edit page for each object. But what if you want a different field — or multiple fields — to be clickable? That’s where list_display_links comes in.


4. Using list_display_links to Improve Navigation

The list_display_links attribute lets you define which fields in the list view are clickable links to the object’s edit page.

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status')
list_display_links = ('title',)

In this example:

  • The title field becomes the clickable link.
  • The author and status fields are displayed as plain text.

This allows you to control navigation flow, making the UI cleaner and more intuitive. For instance, if the author field doesn’t need to be clickable, you can leave it as plain text.


5. Setting list_display_links Correctly

Some key rules when using list_display_links:

  1. The field must be listed in list_display.
  2. If list_display_links is not set, Django makes the first field in list_display the default link.
  3. You can make multiple fields clickable by listing them in a tuple.

Example with multiple links:

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status')
list_display_links = ('title', 'author')

In this case, both title and author columns will link to the edit page.

Tip: Avoid making too many fields clickable — it can clutter the interface and make navigation confusing.


6. Controlling Pagination with list_per_page

The second important usability setting is pagination. By default, Django displays 100 records per page in the admin list view. For large datasets, loading 100 records at once can slow down the page and overwhelm the user.

You can control this with the list_per_page attribute:

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status')
list_display_links = ('title',)
list_per_page = 20

This displays only 20 records per page, adding pagination controls at the bottom of the list view.


7. Why Pagination Improves Performance

Pagination isn’t just about aesthetics — it significantly impacts performance.

  • Faster page load times — fewer database rows are fetched at once.
  • Reduced memory usage — the admin template renders fewer objects.
  • Better user experience — users don’t have to scroll endlessly.
  • Efficient queries — Django uses database-level pagination to limit records.

For models with thousands of entries, setting a reasonable page size like 20, 50, or 100 can make a big difference.


8. How to Customize Pagination

The two main pagination-related settings in ModelAdmin are:

  • list_per_page — number of records displayed on each page.
  • list_max_show_all — maximum number of records displayed when users click “Show all.”
class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status')
list_display_links = ('title',)
list_per_page = 25
list_max_show_all = 200

This configuration:

  • Displays 25 records per page by default.
  • Allows users to view up to 200 records when clicking “Show all.”

If your dataset is very large, setting list_max_show_all to a lower value can prevent performance issues.


9. Combining list_display_links and Pagination

The real power of these settings comes when you combine them strategically.

By making the most meaningful field a clickable link and controlling pagination, you create an interface that is both clear and fast.

For example:

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status', 'published_date')
list_display_links = ('title',)
list_per_page = 20
  • title is clickable, allowing quick access to edit.
  • Other fields provide context without overwhelming the interface.
  • Pagination keeps the list manageable.

10. Practical Example: Book Management

Let’s build a practical admin interface for managing a large catalog of books.

models.py

from django.db import models

class Book(models.Model):
title = models.CharField(max_length=255)
author = models.CharField(max_length=255)
status = models.CharField(max_length=50)
published_date = models.DateField()
def __str__(self):
    return self.title

admin.py

from django.contrib import admin
from .models import Book

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status', 'published_date')
list_display_links = ('title',)
list_per_page = 20
list_max_show_all = 200
admin.site.register(Book, BookAdmin)

Now, your admin list view:

  • Shows key information at a glance.
  • Makes titles clickable for editing.
  • Loads quickly even with thousands of records.
  • Keeps navigation clear and simple.

11. Handling Large Datasets in Admin

When dealing with large datasets (tens or hundreds of thousands of rows), consider these tips:

  1. Set list_per_page to a manageable number like 25 or 50.
  2. Use search fields or filters to narrow down results quickly.
  3. Avoid displaying fields that require complex database lookups.
  4. Consider indexing fields at the database level for faster queries.

These adjustments make the admin list view more efficient for both the system and the user.


12. Using list_max_show_all for Additional Control

The list_max_show_all attribute lets you control the upper limit of the “Show all” feature.

By default, if a user clicks “Show all,” Django tries to render all objects — which can be disastrous for performance in large datasets.

Example:

class BookAdmin(admin.ModelAdmin):
list_max_show_all = 200

This caps the maximum number of records displayed when clicking “Show all” at 200. If there are more than 200 records, Django will not allow showing them all at once.

This small setting can protect your admin interface from accidental overload.


13. Best Practices for Choosing Display Links

When deciding which fields to make clickable with list_display_links, keep these best practices in mind:

  • Pick the most identifying field — typically the title or name of the object.
  • Limit to 1–2 fields to keep the interface clean.
  • Avoid links on computed or formatted fields unless necessary.
  • Be consistent across models so that admins know what to click.

For example, in an order management system, the order_id might be the best clickable field, while in a book system, title is ideal.


14. Integrating Search and Filters with Pagination

Pagination works best when combined with search and filtering.

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status')
list_display_links = ('title',)
search_fields = ('title', 'author')
list_filter = ('status',)
list_per_page = 20

With this configuration:

  • Users can quickly search for books by title or author.
  • Filter by status (e.g., available, checked out, archived).
  • Only 20 records appear at a time, keeping it fast and easy to navigate.

15. Using ordering for Better Data Presentation

Sorting the data in a meaningful way can also improve usability. Use the ordering attribute in ModelAdmin:

class BookAdmin(admin.ModelAdmin):
ordering = ('title',)

This ensures that the list view always appears sorted alphabetically by title. Combined with pagination, this provides a consistent and predictable interface.


16. Common Mistakes and How to Avoid Them

  1. Making too many fields clickable — leads to confusion.
  2. Leaving default pagination at 100 on very large datasets — causes slow pages.
  3. Including fields with heavy lookups — slows down rendering.
  4. Ignoring list_max_show_all — can result in performance issues if someone clicks “Show all.”
  5. Not using search or filters — makes it hard to find specific records.

Avoiding these mistakes will help maintain a clean and fast admin interface.


17. Advanced Example with Multiple Links

Sometimes, making more than one field clickable can make sense — for example, in a system where both the title and the author identify the record clearly.

class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status')
list_display_links = ('title', 'author')
list_per_page = 30

Here:

  • Clicking either the title or the author takes you to the edit page.
  • Other columns remain static, improving navigation flexibility.

Caution: Don’t make all columns clickable — it clutters the UI.


18. Improving User Experience for Non-Technical Admins

Many Django admin users are non-technical — librarians, managers, editors, or operations teams. For them, a well-optimized admin interface can make a huge difference in day-to-day workflows.

Using list_display_links and pagination effectively can:

  • Make navigation intuitive — users know exactly where to click.
  • Prevent overwhelming interfaces.
  • Improve overall speed, even on slower computers or networks.
  • Reduce training time and support requests.

Small improvements can lead to big productivity gains for non-developers.


19. Performance Considerations in Pagination

When choosing pagination settings, keep performance in mind:

  • Database queries: Django uses SQL LIMIT and OFFSET under the hood, so pagination is efficient.
  • Indexing: Make sure the ordering and filter fields are indexed at the database level for faster queries.
  • Prefetching: If you’re displaying related fields (like author from a foreign key), consider using list_select_related to reduce query count.
class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'status')
list_display_links = ('title',)
list_per_page = 25
list_select_related = ('author',)

This tells Django to prefetch related author objects, preventing the “N+1 queries” problem and speeding up rendering.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *