rents_system

RENTS - Residents Entry, Navigation, and Tenant Tracking System

A Django-based boarding house management system for managing tenants, rooms, billing, maintenance, and violations.

Current Status: Production Ready v2.4

Latest Updates (April 27, 2026 - Late Night):

Previous Updates (April 27, 2026 - Evening):

Previous Updates (April 27, 2026 - Morning):

Previous Updates (April 24, 2026):

Previous Updates (March-April 2026):


🗂️ Project Structure

rents_system/
│
├── manage.py
├── requirements.txt
├── .env                          ← environment variables (NOT in repo)
├── .env.example                  ← template for .env configuration
├── .gitignore                    ← defines what's excluded from git
│
├── static/                       ← CENTRALIZED static files (source)
│   ├── js/
│   │   ├── login.js
│   │   ├── login_fixed.js
│   │   ├── dashboard.js
│   │   └── profile-confirmation.js
│   └── css/
│       ├── dashboard.css
│       ├── avatar.css
│       └── modal-fix.css   
│
├── staticfiles/                  ← AUTO-GENERATED (NOT in repo)
│   ├── js/
│   │   ├── login.js
│   │   ├── login.[hash].js       ← versioned for cache-busting
│   │   └── ...
│   └── css/
│       ├── dashboard.css
│       ├── dashboard.[hash].css  ← versioned for cache-busting
│       └── ...
│
├── rents_system/                 ← project config
│   ├── settings.py
│   ├── urls.py
│   ├── asgi.py
│   └── wsgi.py
│
└── accounts/                     ← main app
    ├── migrations/
    ├── templates/
    │   ├── login.html
    │   ├── base_dashboard.html
    │   ├── admin/
    │   │   ├── dashboard.html
    │   │   ├── admin_list.html
    │   │   ├── tenant_list.html
    │   │   └── room_list.html
    │   ├── tenant/
    │   │   └── dashboard.html
    │   ├── partials/
    │   │   ├── avatar.html
    │   │   └── sidebar.html
    │   └── registration/
    │       ├── password_reset_form.html
    │       └── ...
    │
    ├── templatetags/
    │   ├── __init__.py
    │   └── avatar_tags.py
    │
    ├── models.py
    ├── views.py
    ├── urls.py
    ├── admin.py
    └── apps.py

🗄️ Database Structure

auth_user (Django built-in)

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | username | VARCHAR | Login username | | password | VARCHAR | Hashed password | | email | VARCHAR | Email address | | is_staff | BOOL | True = Admin | | is_superuser | BOOL | True = Superadmin | | is_active | BOOL | False = Deactivated |

accounts_tenantprofile

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | user_id | FK | → auth_user | | full_name | VARCHAR | Full name | | phone | VARCHAR | Phone number | | room_id | FK | → accounts_room | | room_number | VARCHAR | Legacy room number | | photo | IMAGE | Profile photo (optional) | | created_at | DATETIME | Account creation date |

accounts_adminprofile

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | user_id | FK | → auth_user | | full_name | VARCHAR | Full name | | phone | VARCHAR | Phone number | | photo | IMAGE | Profile photo (optional) | | created_by_id | FK | → auth_user (Superadmin) | | created_at | DATETIME | Account creation date |

accounts_inclusion

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | name | VARCHAR | Inclusion name (unique) | | created_at | DATETIME | Creation timestamp |

accounts_appliance

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | name | VARCHAR | Appliance name (unique) | | created_at | DATETIME | Creation timestamp |

accounts_room

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | room_number | VARCHAR | Room identifier (A, B, 1, etc.) | | floor | INT | Floor number | | capacity | INT | Max beds | | monthly_rate | DECIMAL | Rent price | | photo | IMAGE | Room photo (optional) | | area | DECIMAL | Area in sqm | | num_cr | INT | Number of CRs | | bed_type | VARCHAR | Single/Double Deck/Both | | has_sink | BOOL | Has sink | | water_included | BOOL | Water included | | electricity_included | BOOL | Electricity included | | has_fan | BOOL | Has fan | | has_aircon | BOOL | Has aircon | | has_ref | BOOL | Has refrigerator | | has_tv | BOOL | Has TV | | has_wifi | BOOL | Has WiFi | | dynamic_inclusions | M2M | → accounts_inclusion | | dynamic_appliances | M2M | → accounts_appliance |

accounts_activitylog

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | user_id | FK | → auth_user (nullable) | | action | VARCHAR | Action type (bill_generated, payment_recorded, etc.) | | description | TEXT | Human-readable description | | content_type | VARCHAR | Related model name (e.g., Bill, TenantProfile) | | object_id | INT | ID of related object | | timestamp | DATETIME | When the action occurred |

accounts_bill

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | tenant_id | FK | → tenantprofile | | amount | DECIMAL | Bill amount | | due_date | DATE | Due date | | is_paid | BOOL | Payment status | | created_at | DATETIME | Created date |

accounts_maintenancereport

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | tenant_id | FK | → tenantprofile | | description | TEXT | Report description | | status | VARCHAR | open / ongoing / completed | | created_at | DATETIME | Submitted date |

accounts_violation

| Field | Type | Description | |—|—|—| | id | INT | Primary key | | tenant_id | FK | → tenantprofile | | description | TEXT | Violation description | | date | DATE | Violation date | | created_at | DATETIME | Logged date |


👥 User Roles

Role is_staff is_superuser Access
Superadmin Full access + Register Admins
Admin Manage tenants, rooms, billing
Tenant View own profile, bills, reports

✅ Features (Current)

Authentication

Room Management

Dynamic Features Management

Tenant Management

Admin Management (Superadmin only)

Billing System

Dashboard

User Experience


🚧 Features (Planned)


⚙️ Setup Instructions

1. Clone the repository

git clone https://github.com/KevzBueno101/rents_system.git
cd rents_system

2. Install dependencies

pip install -r requirements.txt

3. Create .env file

Copy .env.example and fill in your values:

cp .env.example .env
SECRET_KEY=your_secret_key_here
DEBUG=True
DB_NAME=rents_db
DB_USER=root
DB_PASSWORD=
DB_HOST=localhost
DB_PORT=3306
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your_email@gmail.com
EMAIL_HOST_PASSWORD=your_app_password
DEFAULT_FROM_EMAIL=your_email@gmail.com

⚠️ IMPORTANT: Never commit .env to git. It should be in .gitignore

4. Create MySQL database

CREATE DATABASE rents_db;

5. Run migrations

python manage.py makemigrations
python manage.py migrate

6. Collect static files

python manage.py collectstatic --noinput

7. Create Superadmin

python manage.py createsuperuser

8. Seed Initial Features (Optional)

python manage.py seed_inclusions_appliances

This creates default inclusions (Water, Electricity, Internet, etc.) and appliances (Fan, Air Conditioner, Microwave, etc.)

9. Run the server

python manage.py runserver

10. Open in browser

http://127.0.0.1:8000/

� Static Files Management

Understanding static/ vs staticfiles/

static/ directory (source - what you edit)

staticfiles/ directory (generated - production-ready)

Development Workflow

# 1. Edit your static files
nano static/js/login.js

# 2. Collect static files (generates versioned copies)
python manage.py collectstatic --noinput

# 3. Test locally
python manage.py runserver

# 4. Commit changes
git add static/
git commit -m "Update login.js functionality"
git push origin dev

🔐 Security & Environment Configuration

Configuration Files

File Location Git Tracked Purpose
.env Root ❌ NO Your actual secrets (never commit)
.env.example Root ✅ YES Template for other developers
.gitignore Root ✅ YES Defines what to exclude from git

Best Practices

  1. Never commit .env - always ensure it’s in .gitignore
  2. Use .env.example - provide template for configuration
  3. Regenerate SECRET_KEY if compromised - use python manage.py shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
  4. Different keys per environment - dev, staging, production should have different SECRET_KEYs
  5. On production servers - manually create .env file with production credentials

�🛠️ Tech Stack

Technology Usage
Python 3.12 Backend language
Django 4.2.7 Web framework
MySQL Database
Bootstrap 5.3 Frontend UI
Bootstrap Icons Icons
Pillow Image handling
python-dotenv Environment variables
WhiteNoise Static files

📁 Environment Variables

Variable Description Example
SECRET_KEY Django cryptographic key (keep secure!) 3ot&+cue4i760gjrayixr!1a3tq_%h#...
DEBUG True (local) / False (production) True
DB_NAME Database name rents_db
DB_USER Database user root
DB_PASSWORD Database password (leave empty for local dev)
DB_HOST Database host localhost
DB_PORT Database port 3306
EMAIL_HOST SMTP server for emails smtp.gmail.com
EMAIL_PORT SMTP port 587
EMAIL_USE_TLS Use TLS encryption True
EMAIL_HOST_USER Email account for sending your_email@gmail.com
EMAIL_HOST_PASSWORD Email app password (your app password)
DEFAULT_FROM_EMAIL Default “from” email RENTS System <email@example.com>

👨‍💻 Developer

Kevin Bueno — RENTS System
GitHub: @KevzBueno101