Skip to main content

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

  1. Install package dependencies and the app:
pip install -e .
  1. Add apps in settings.py:
INSTALLED_APPS = [
    # ...
    "rest_framework",
    "django_ai_admin",
]
  1. Add URLs in root urls.py:
from django.urls import include, path

urlpatterns = [
    # ...
    path("ai-assistant/", include("django_ai_admin.urls")),
]
  1. Run migrations:
python manage.py migrate
  1. 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

  1. Log in as superuser.
  2. Open Admin -> Django Ai Admin -> AI configs.
  3. Create or edit the config record and fill:
    • provider: openai
    • api_key: your API key
    • model: for example gpt-4o-mini
    • temperature: for example 0.2
    • max_tokens: for example 1024
    • timeout_sec: for example 30
  4. Save.

2) Use the assistant

  1. Open any Django Admin page as a staff user.
  2. Click Open AI in the admin header.
  3. Start a new chat and ask a data question about your project models.
  4. 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:

  1. Create a PyPI API token and add it to repository secrets as PYPI_API_TOKEN.
  2. Make sure pyproject.toml version matches the release (for example 0.1.0).
  3. Create and push a tag:
git tag v0.1.0
git push origin v0.1.0

What happens automatically:

  • Release workflow builds sdist and wheel
  • creates a GitHub Release with attached artifacts
  • publishes to PyPI (if PYPI_API_TOKEN is configured)

Install command after publish:

pip install django-admin-ai-assistant==0.1.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_ai_assistant-0.1.0.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_ai_assistant-0.1.0-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_ai_assistant-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django_admin_ai_assistant-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb0a17db3f488e68388623526e09889af43dbbfa755adfb4de43fb8fad52d6d9
MD5 0f358a9df60cb35ef4ae619c93ad3546
BLAKE2b-256 10877dce79aec8d91fd6ef57e2bf507da9819d7bc2e742924b4091ab3820cba6

See more details on using hashes here.

File details

Details for the file django_admin_ai_assistant-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_ai_assistant-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4456e18b6979aa9fedf1979f22cb99c30ee8f11c9c2bf94749b75d33212ba03d
MD5 f318116f775a6c9d741a20aa21f976f4
BLAKE2b-256 345e2b8e8505090970d4074a8a22f9f2d9ead20bfed24997a8b9b10d70c0e259

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page