claudegoodies
Command

admin

From davila7

Configure Django admin interface with custom admin classes and functionality.

Generates a Django admin.py with ModelAdmin classes, inlines, list displays, filters, and bulk actions.

Use it when

  • Registering Django models in admin.py with custom list/search/filter config
  • Adding inline editing for related models like comments under posts
  • Adding bulk admin actions such as publish/draft/duplicate for querysets
  • Customizing admin list displays with computed fields like image previews or counts

Skip it if

  • Not a Django project
  • Need admin customization beyond ModelAdmin (custom admin site, templates, permissions)
  • Want hand-tuned admin classes rather than generated boilerplate to edit

Install

/admin

Facts

Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this command runs.

# Django Admin Configuration

Configure Django admin interface with custom admin classes and functionality.

## Purpose

This command helps you create comprehensive Django admin configurations with advanced features and customizations.

## Usage

```
/admin
```

## What this command does

1. **Registers models** with custom admin classes
2. **Creates advanced admin interfaces** with filtering, search, and actions
3. **Adds inline editing** for related models
4. **Customizes list displays** and forms
5. **Implements admin actions** for bulk operations

## Example Output

```python
# admin.py
from django.contrib import admin
from django.utils.html import format_html
from django.urls import reverse
from django.utils.safestring import mark_safe
from .models import Post, Category, Tag, Comment

@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    """Admin configuration for Category model."""
    list_display = ['name', 'slug', 'post_count', 'created_at']
    list_filter = ['created_at']
    search_fields = ['name', 'description']
    prepopulated_fields = {'slug': ('name',)}
    readonly_fields = ['created_at', 'updated_at']
    
    def post_count(self, obj):
        """Display number of posts in this category."""
        count = obj.posts.count()
        url = reverse('admin:blog_post_changelist') + f'?category__id__exact={obj.id}'
        return format_html('<a hr
View full source on GitHub →

Other slash commands