---
slug: "django-user-admin-show-is-active-only"
title: "Exclude Users with is_active = False in Django Admin (Replacing the User Admin)"
description: "Python script to copy AWS RDS MySQL data from production to a dev environment fast — table-level `mysqldump` + `mysql` piping."
url: "https://www.ytyng.com/en/blog/django-user-admin-show-is-active-only"
publish_date: "2022-11-16T00:19:10Z"
created: "2022-11-16T00:19:10Z"
updated: "2026-05-11T13:21:52.946Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20250711/cf7012610c7d4351ad16daf066ad105a.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Exclude Users with is_active = False in Django Admin (Replacing the User Admin)

In UserAdmin, I will display only users with `is_active = True`.

```python
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

class ReplacedUserAdmin(UserAdmin):
    list_display = (
        'id',
        'email',
        'username',
        'last_name',
        'first_name',
        'date_joined',
        'is_staff',
        'is_superuser',
    )
    ordering = ('-is_active', '-id',)

    def get_queryset(self, request):
        return super().get_queryset(request).filter(is_active=True)

# Replace UserAdmin.
admin.site.unregister(User)
admin.site.register(User, ReplacedUserAdmin)
```

When using the `@admin.register` decorator, it doesn't work well due to the order of code evaluation.

Write these two lines together:

```
admin.site.unregister(User)
admin.site.register(User, ReplacedUserAdmin)
```
