Embedded AI assistant for Django Admin with read-only ORM execution.
Project description
django-admin-ai-assistant
Reusable Django application with an embedded AI assistant inside Django Admin.
Installation
- Install package dependencies and the app:
pip install -e .
- Add apps in
settings.py:
INSTALLED_APPS = [
# ...
"rest_framework",
"django_ai_admin",
]
- Add URLs in root
urls.py:
from django.urls import include, path
urlpatterns = [
# ...
path("ai-assistant/", include("django_ai_admin.urls")),
]
- Run migrations:
python manage.py migrate
- Optional settings in
settings.py:
DJANGO_AI_ADMIN_URL_PREFIX = "ai-assistant"
DJANGO_AI_ADMIN_ADMIN_SITE = "backend.admin_site.admin_site" # optional
DJANGO_AI_ADMIN_OPENAI_BASE_URL = "https://api.openai.com/v1"
Usage
1) Configure AI in Django Admin
- Log in as superuser.
- Open
Admin -> Django Ai Admin -> AI configs. - Create or edit the config record and fill:
provider:openaiapi_key: your API keymodel: for examplegpt-4o-minitemperature: for example0.2max_tokens: for example1024timeout_sec: for example30
- Save.
2) Use the assistant
- Open any Django Admin page as a staff user.
- Click
Open AIin the admin header. - Start a new chat and ask a data question about your project models.
- Review response, result, and optional details (interpretation/explanation/code).
Docker Demo Project
A ready-to-run example project is included in example_project/ with simple polls models (Question, Choice) and admin integration.
From the repository root:
cd example_project
make dev
Then open:
http://localhost:8000/admin/- login:
admin/admin
See example_project/README.md for details.
Release (PyPI)
Package metadata currently uses:
- package name:
django-admin-ai-assistant - version:
0.1.0
To publish from GitHub Actions:
- Create a PyPI API token and add it to repository secrets as
PYPI_API_TOKEN. - Make sure
pyproject.tomlversion matches the release (for example0.1.0). - Create and push a tag:
git tag v0.1.0
git push origin v0.1.0
What happens automatically:
Releaseworkflow buildssdistandwheel- creates a GitHub Release with attached artifacts
- publishes to PyPI (if
PYPI_API_TOKENis configured)
Install command after publish:
pip install django-admin-ai-assistant==0.1.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_admin_ai_assistant-0.1.0.tar.gz.
File metadata
- Download URL: django_admin_ai_assistant-0.1.0.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb0a17db3f488e68388623526e09889af43dbbfa755adfb4de43fb8fad52d6d9
|
|
| MD5 |
0f358a9df60cb35ef4ae619c93ad3546
|
|
| BLAKE2b-256 |
10877dce79aec8d91fd6ef57e2bf507da9819d7bc2e742924b4091ab3820cba6
|
File details
Details for the file django_admin_ai_assistant-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_admin_ai_assistant-0.1.0-py3-none-any.whl
- Upload date:
- Size: 41.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4456e18b6979aa9fedf1979f22cb99c30ee8f11c9c2bf94749b75d33212ba03d
|
|
| MD5 |
f318116f775a6c9d741a20aa21f976f4
|
|
| BLAKE2b-256 |
345e2b8e8505090970d4074a8a22f9f2d9ead20bfed24997a8b9b10d70c0e259
|