bhylu.com

Advertisements

Django Admin Registration

The admin is an internal data-management interface, not an automatically suitable public booking UI. Register the models you want staff to manage and review each capability.

How it works

Our admin lists venues and workshops with searchable labels. Reservation fields are read-only and manual add/delete are disabled so staff cannot bypass the seat-count service accidentally. Workshop editing also needs a clear policy about capacity and availability. A readable administration screen does not replace business validation, object permissions or an audit requirement. Create your own local admin account interactively instead of sharing credentials.

Run in the supplied local Django project

This lesson uses Django 5.2.18 LTS with Python 3.12. Download the source downloader and run node download-project.mjs http://127.0.0.1:8000 with Node 22 while previewing locally. It creates a new bhylu-django-lab folder and refuses to overwrite an existing one. After deployment, the default base is bhylu.com; until then use your local preview URL.

Inside that new folder, create a virtual environment, install requirements.txt and run the complete lesson file shown below. Every lesson creates a fresh in-memory SQLite database and temporary upload storage. It does not edit the interactive lab’s db.sqlite3 or Bhylu’s database. The visible listing below is the lesson’s core code; its complete downloaded file includes the shared bootstrap.

Django does not run in Bhylu’s current browser playground. No Apache, MySQL or global PHP configuration change is needed. See the setup lesson for the full project and commands.

Example

Run .venv\Scripts\python.exe lessons\admin-registration.py from the downloaded project root. Download the complete lesson file; keep it under lessons/. The project’s shared models, forms, views and fixture are prerequisites, not a hidden online runtime.

lessons/admin-registration.py — core code

from django.contrib import admin
from workshops.admin import ReservationAdmin
print(Workshop in admin.site._registry)
admin_object = admin.site._registry[Reservation]
request = RequestFactory().get("/admin/")
print(admin_object.has_add_permission(request))
print(admin_object.has_delete_permission(request))

Expected result

True
False
False

Registration exposes the workshop model, while reservation operations are intentionally restricted. The actual booking service remains the source of seat-count rules. Advanced admin customizations should call that service rather than duplicate it incompletely.

Use Django’s versioned official documentation for exact API contracts and the deployment checklist before a separate release.

Advertisements