A Django-based housing management application for universities. It supports multi-campus accommodation, institutional student and staff accounts, room and bed inventory, approval-based bookings, and the lifecycle of accommodation assignments.
The project is designed around a practical university housing process: administrators configure accommodation and provision accounts, students claim their accounts and request housing, and authorized housing staff allocate beds and manage occupancy.
Project status: Active development. The backend contains the principal domain models, services, policies, forms, and views. The PostgreSQL development baseline is established; the server-rendered frontend is being rebuilt and integrated incrementally. Not all workflows are currently available through a complete user interface, and additional automated coverage is planned for critical housing operations.
The following summarizes the backend capabilities and intended application scope. It is not a claim that every workflow is already fully integrated or verified end to end.
| Area | Capabilities |
|---|---|
| Accounts | Institution-provisioned accounts, login, logout, and multi-stage account claiming with temporary credentials and date-of-birth verification |
| Student and staff profiles | Institutional identifiers, personal profiles, academic records, campus placement, staff roles, and roster import services |
| Accommodation | Campuses, buildings, floors, rooms, beds, reusable bed configurations, and operational restrictions |
| Allocation | Automatic, recommended, and manual allocation; individual and group allocation requests |
| Assignments | Reservations, check-in, checkout, deadline extensions, transfers, eligibility reviews, and termination |
| Bookings | Booking periods, individual and group requests, invitations, temporary holds, and approval workflows |
| Roommate coordination | Roommate groups and shared housing requests |
- Global administrator: System-wide institutional configuration and authorized administration.
- Building manager: Management and operations within the assigned building.
- Building staff: Authorized day-to-day housing operations within the assigned building.
- Student: Personal housing requests, roommate coordination, and permitted assignment operations.
Actual access is determined by the domain authorization policies, account status, profile status, and resource scope. Public self-registration is not supported.
| Layer | Technology |
|---|---|
| Backend | Python, Django 5.2 |
| Database | PostgreSQL, Psycopg 3 |
| Frontend | Django templates, HTML5, CSS, Bootstrap 5.3, Bootstrap Icons; vanilla JavaScript for progressive enhancement |
| Configuration | python-dotenv |
| Profile imports | CSV and Excel (openpyxl) |
| Testing | Django test framework, Python unittest |
The system is a modular Django monolith, using server-rendered pages rather than a separate SPA or REST API frontend.
flowchart TD
U[Browser] --> V[Django URLs and views]
V --> F[Forms and input validation]
V --> P[Authorization policies]
V --> S[Domain services]
F --> S
S --> P
S --> M[Django ORM and models]
M --> DB[(PostgreSQL)]
V --> T[Django templates]
T --> U
The service layer owns domain operations and transactional business logic. Policies define who can perform operations, and models and database constraints protect data integrity. PostgreSQL row locking is used to coordinate conflicting accommodation operations; SQLite is not an equivalent backend for these workflows.
Authentication identities are stored in the User model. Student and staff institutional identifiers belong to their respective profile models, not to the authentication account.
The accommodation hierarchy is University → Campus → Building → Floor → Room → Bed. Academic campus placement is separate from physical bed assignment.
.
├── apps/
│ ├── accounts/ # Authentication and account claiming
│ ├── accommodations/ # Physical housing inventory
│ ├── assignments/ # Allocation and assignment lifecycle
│ ├── bookings/ # Booking and roommate workflows
│ ├── core/ # Policies, locking, shared models and utilities
│ ├── profiles/ # Students, staff and academic records
│ └── university/ # Institutional configuration
├── config/ # Django settings, root URLs and entry points
├── docs/ # Architecture and development documentation
├── static/ # Stylesheets and frontend assets
├── templates/ # Server-rendered HTML templates
├── manage.py
├── requirements.txt
└── README.md
- Python 3.10 or newer (the development environment has used Python 3.10).
- PostgreSQL installed and running.
- Git.
Clone this repository using its GitHub clone URL, then open the project root in a terminal.
Windows (PowerShell)
python -m venv venv
.\venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtLinux/macOS
python3 -m venv venv
source venv/bin/activate
python -m pip install -r requirements.txtUsing an administrative PostgreSQL connection, create a dedicated local database and login role. For a new installation, the following is an example; replace the password before executing it. If the role or database already exists, reuse or configure it instead of recreating it.
CREATE ROLE dms_user WITH LOGIN PASSWORD 'replace-with-a-strong-local-password';
CREATE DATABASE dorm_system OWNER dms_user;
-- Local development only: Django creates a separate database during testing.
ALTER ROLE dms_user CREATEDB;Do not grant the application role superuser permissions. Use a separate development database and appropriate restricted credentials in production.
Create a .env file in the project root:
DJANGO_SECRET_KEY=replace-with-a-generated-secret-key
DB_NAME=dorm_system
DB_USER=dms_user
DB_PASSWORD=replace-with-your-local-database-password
DB_HOST=127.0.0.1
DB_PORT=5432Generate a Django secret key with:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"Use the generated value in .env. Match the database name and credentials to your local PostgreSQL configuration. Never commit .env, passwords, private roster files, or database dumps.
python manage.py migrate
python manage.py check
python manage.py createsuperuserFollow the prompts to create a global administrator. Administrator accounts require an email address and password; the custom user model also requests date of birth through the interactive command.
python manage.py runserverOpen http://127.0.0.1:8000/. Django administration is available at http://127.0.0.1:8000/admin/.
The development server and current development settings are not intended for production deployment. Complete application pages are being integrated module by module; some registered routes may still lack their templates.
Run the full test suite:
python manage.py testRun Django checks and verify migration consistency:
python manage.py check
python manage.py makemigrations --check --dry-run
python manage.py migrate --planRun tests against PostgreSQL so database constraints and locking behavior are exercised on the intended database engine. A successful existing suite is not a substitute for dedicated concurrency and end-to-end workflow tests.
- Keep authorization in policies and business operations in services; avoid implementing domain rules solely in templates or browser scripts.
- Preserve transactional integrity for allocations, bookings, holds, and assignment changes.
- Integrate complete workflows, including validation, permission errors, status transitions, and empty states.
- Use real application data in operational screens rather than placeholder metrics.
- Add regression tests for bug fixes and critical business workflows.
- Establish a PostgreSQL development baseline and restore model and URL integration.
- Establish the initial system-level functional inventory.
- Define the frontend visual direction and shared layout.
- Integrate authentication, account provisioning, profiles, and institutional configuration.
- Integrate accommodation inventory and allocation workflows.
- Integrate assignment lifecycle, roommate groups, and bookings.
- Complete role-specific dashboards and end-to-end workflow tests.
Detailed design decisions and integration progress are maintained in the docs/ directory as the project evolves.