Django Unfoldのロゴ

Django Unfold

組織
CodeAtCode
django-unfold

Use when theming the Django admin with django-unfold - settings and sidebar configuration, custom admin site, components and @display decorator, filters, actions, tabs, dark mode and styling, or Django 6.x compatibility

概要

公開者CodeAtCode
リポジトリoss-ai-skills
スキル名django-unfold
スター
30
フォーク
3
同梱ファイル
3
ライセンスGPL-3.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 3個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    CodeAtCodeがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルDjango UnfoldをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/django-unfold
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CodeAtCode/oss-ai-skills.git /tmp/oss-ai-skills
mkdir -p .claude/skills
cp -r /tmp/oss-ai-skills/frameworks/django-unfold .claude/skills/django-unfold
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでDjango Unfoldを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にDjango Unfoldを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Django Unfoldは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Django Unfold

Objective: Use this skill to reduce admin-broken-layout incidents, @display-misuse bugs, filter-registration failures, and dark-mode regressions by enforcing settings-discipline, decorator-contract rules, and component-registration patterns below.

Modern Django admin theme with Tailwind-based design.


Core Rules (do X because Y)

  1. Put unfold before django.contrib.admin in INSTALLED_APPS because the template engine loads the first admin app it finds and later apps are ignored.

  2. Extend unfold/base.html not admin/base.html because extending the stock Django base bypasses Unfold's CSS, sidebar, and dark-mode blocks.

  3. Use UPPER_CASE keys in UNFOLD dict because lowercase keys are silently ignored at runtime.

  4. Define UNFOLD in settings.py not admin.py because the theme reads settings at import time; putting it in admin.py causes partial initialization.

  5. Register @display methods before list_display references them because late decorators don't bind to the admin metaclass and the column renders empty.

  6. Use UNFOLD's COLORS palette not raw CSS overrides because !important rules fight the Tailwind cascade and break on Unfold updates.

  7. Test dark mode with system preference toggled because DARK_MODE_COLORS that mirror light mode create invisible text and broken contrast.


Installation

bash
pip install django-unfold
python
# settings.py
INSTALLED_APPS = [
    'unfold',  # Must come BEFORE django.contrib.admin
    'django.contrib.admin',
    'django.contrib.auth',
    # ...
]

UNFOLD = {
    'SITE_HEADER': 'My Admin',
}

Custom Admin Site

Do this because: Default admin site class doesn't expose custom context or override authentication flow.

python
# admin.py
from unfold.admin import UnfoldAdminSite

class CustomAdminSite(UnfoldAdminSite):
    site_header = 'Custom Portal'
    
    def each_context(self, request):
        context = super().each_context(request)
        context['custom_branding'] = get_branding()
        return context

admin_site = CustomAdminSite(name='custom')
python
# settings.py
UNFOLD_ADMIN_SITE_CLASS = 'myapp.admin.CustomAdminSite'

See references/settings-customization.md for full settings reference, sidebar config, and dark mode controls.


@display Decorator (Django 6.0+)

Do this because: Without proper decorator usage, list_display columns render empty or unsortable.

python
from unfold.decorators import display

class UserAdmin(ModelAdmin):
    @display(description="Active", boolean=True)
    def is_active(self, obj):
        return obj.is_active
    
    @display(description="Full Name", order="username")
    def full_name(self, obj):
        return f"{obj.first_name} {obj.last_name}"
    
    list_display = ['username', 'is_active', 'full_name']

Failure mode: Column shows blank because @display must be applied before the method is referenced in list_display.

See references/components-actions.md for @display parameters and field/widget patterns.


Filters

Do this because: Default admin filters don't integrate with Unfold's dropdown styling and can break on large FK fields.

python
import unfold.filters as filters

class ArticleAdmin(ModelAdmin):
    list_filter = [
        ('status', filters.DropdownFilter),  # Better than SelectFilter for long lists
        ('author', filters.AutocompleteFilter),  # Required for >100 authors
        ('created_at', filters.DateRangeFilter),
    ]

Failure mode: Filter dropdown renders as stock Django select because you used list_filter = ['field'] without Unfold's filter class.

See references/components-actions.md for complete filter type listings.


Actions

Do this because: Stock admin actions lack Unfold's button styling and confirmation UI.

python
from unfold.decorators import action

class ArticleAdmin(ModelAdmin):
    @action(description='Publish selected articles')
    def publish_selected(self, request, queryset):
        queryset.update(status='published')
    
    actions = ['publish_selected']

Failure mode: Action runs but shows no success message because message_level wasn't set or the method wasn't registered in actions.

See references/components-actions.md for row actions and CSV export patterns.


Common Pitfalls

INSTALLED_APPS Ordering

Failure: Unfold silently ignored, admin renders with default Django theme.

python
# WRONG
INSTALLED_APPS = [
    'django.contrib.admin',  # ❌ Already loaded templates
    'unfold',
]

# CORRECT
INSTALLED_APPS = [
    'unfold',  # ✅ Template override works
    'django.contrib.admin',
]

Template Extension Mistake

Failure: Custom template loses Unfold styling.

python
# WRONG
{% extends "admin/base.html" %}  # ❌ No Unfold blocks

# CORRECT
{% extends "unfold/base.html" %}  # ✅ Gets CSS, layout, sidebar

Styling Without Theme Pipeline

Failure: Custom CSS conflicts with Unfold's Tailwind classes.

python
# WRONG
UNFOLD = {
    'STYLES': ['css/custom.css'],
}
/* custom.css */
.sidebar { background: blue !important; }  # ❌ Brittle

Correct:

python
UNFOLD = {
    'COLORS': {
        'primary': {
            '500': '59 130 246',
        },
    },
}

Integrations

django-guardian

Do this because: You need per-object permissions beyond Django's model-level permissions.

python
INSTALLED_APPS = ['guardian', 'unfold', 'django.contrib.admin']

from unfold.contrib.guardian.admin import GuardedModelAdmin

class ArticleAdmin(GuardedModelAdmin):
    pass

URL: https://github.com/django-guardian/django-guardian

django-import-export

Do this because: Non-technical users need bulk import/export via admin.

python
from import_export import resources
from unfold.admin import ImportExportMixin

class ArticleResource(resources.ModelResource):
    class Meta:
        model = Article
        fields = ('id', 'title', 'status')

class ArticleAdmin(ImportExportMixin, ModelAdmin):
    resource_classes = [ArticleResource]

URL: https://github.com/django-import-export/django-import-export

django-celery-beat

Do this because: You need cron-like scheduling with admin UI.

python
# Automatic integration - no config needed
pip install django-celery-beat

URL: https://github.com/celery/django-celery-beat

django-constance

Do this because: You need runtime site-wide settings without redeploy.

python
INSTALLED_APPS = ['constance', 'unfold']
# Automatic integration

URL: https://github.com/jazzband/django-constance

See references/ecosystem-compat.md for django-unfold-modal, django-unfold-markdown, and Django 6.x compatibility patches.


When Not to Use Unfold

Stock Django admin is sufficient when:

  • Small internal projects — Admin used by <5 power users, no branding requirements
  • Heavy customization needed — Unfold's template override layer becomes maintenance cost when rewriting 50% of templates
  • No Tailwind expertise — Adding Tailwind build pipeline just for admin theming is overkill

Check before adopting:

  1. Does your team have Tailwind CSS experience?
  2. Will admin branding be reviewed by stakeholders?
  3. Is the admin used frequently enough to justify the UX investment?

Deep Dives

For detailed reference, load these on-demand:

  • Settings & Customization — references/settings-customization.md - Full settings reference, custom admin site, dark mode, sidebar config
  • Components & Actions — references/components-actions.md - @display decorator, filters, actions, tabs, fields/widgets
  • Ecosystem & Compatibility — references/ecosystem-compat.md - django-unfold-modal, django-unfold-markdown, Django 6.x patches

References

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Django Unfold」では何ができますか?

Use when theming the Django admin with django-unfold - settings and sidebar configuration, custom admin site, components and @display decorator, filters, actions, tabs, dark mode and styling, or Django 6.x compatibility

TypingMindでDjango Unfoldを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Django Unfoldはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにDjango Unfoldをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/django-unfoldを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Django Unfoldを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Django Unfoldは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもDjango Unfoldを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Django Unfold」は無料ですか?

はい。CodeAtCodeがGitHubでGPL-3.0ライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇