A comprehensive Django web application designed for individual users to manage their personal finances and track expenses.
- User registration with email
- Secure login/logout functionality
- Each user has isolated data (can only view/manage their own expenses)
- Add new expenses with amount, category, description, and date
- Edit existing expenses
- Delete unwanted expenses
- List all expenses with filtering options
- Predefined categories: Food, Transport, Rent, Entertainment, Health, Shopping, Utilities, Education, Other
- Custom categories: Users can create their own categories
- Ability to delete custom categories
- Filter expenses by month and year
- View total spending per month
- Category-wise breakdown with percentages
- CSV Export: Download monthly reports as CSV files
- Pie Chart: Visual breakdown of expenses by category
- Bar Chart: Daily expenses for the last 7 days
- Interactive and responsive charts
- Quick overview of monthly and total expenses
- Recent expenses list
- Visual charts and statistics
- Quick action buttons
- Backend: Django 5.0.1
- Database: SQLite (for development)
- Frontend: Django Templates + Bootstrap 5
- Charts: Chart.js 4.4.0
- Icons: Font Awesome 6.4.0
project/
โโโ manage.py
โโโ requirements.txt
โโโ db.sqlite3 (created after migrations)
โโโ expense_tracker/ # Main project configuration
โ โโโ __init__.py
โ โโโ settings.py # Project settings
โ โโโ urls.py # Main URL configuration
โ โโโ wsgi.py
โ โโโ asgi.py
โโโ expenses/ # Main application
โ โโโ __init__.py
โ โโโ models.py # Category & Expense models
โ โโโ views.py # All view logic
โ โโโ forms.py # Django forms
โ โโโ urls.py # App URL patterns
โ โโโ admin.py # Admin interface configuration
โ โโโ apps.py
โ โโโ management/ # Custom management commands
โ โโโ commands/
โ โโโ create_categories.py
โโโ templates/ # HTML templates
โโโ base.html # Base template with Bootstrap
โโโ expenses/
โโโ login.html
โโโ register.html
โโโ dashboard.html
โโโ expense_list.html
โโโ expense_form.html
โโโ expense_confirm_delete.html
โโโ category_list.html
โโโ category_form.html
โโโ category_confirm_delete.html
โโโ monthly_report.html
- Python 3.8 or higher
- pip (Python package manager)
-
Clone or navigate to the project directory
cd /root/ymomen/project -
Create a virtual environment (recommended)
python -m venv venv source venv/bin/activate # On Linux/Mac # or venv\Scripts\activate # On Windows
-
Install dependencies
pip install -r requirements.txt
-
Run database migrations
python manage.py makemigrations python manage.py migrate
-
Create predefined categories
python manage.py create_categories
-
Create a superuser (for admin access)
python manage.py createsuperuser
-
Run the development server
python manage.py runserver
-
Access the application
- Main app: http://127.0.0.1:8000/
- Admin panel: http://127.0.0.1:8000/admin/
-
Register a new account
- Navigate to the registration page
- Fill in username, email, and password
- You'll be automatically logged in after registration
-
Add your first expense
- Click "Add Expense" button
- Enter amount, select category, choose date
- Optionally add a description
- Click "Save Expense"
-
View your dashboard
- See monthly and total spending summaries
- View charts showing expense breakdown
- Check recent expenses
-
Manage categories
- View all predefined categories
- Create custom categories for your needs
- Delete custom categories if not needed
-
Generate reports
- Go to "Reports" section
- Select month and year
- View detailed breakdown
- Export to CSV for external use
- Filter by category to see specific types of expenses
- Filter by month and year to analyze spending patterns
- View total amounts for filtered results
- Comprehensive breakdown by category
- Shows count and percentage for each category
- Detailed list of all expenses in the month
- One-click CSV export
- Each user can only see their own data
- Secure authentication required
- Database-level isolation ensures privacy
- Responsive Design: Works on desktop, tablet, and mobile
- Bootstrap 5: Modern and clean interface
- Font Awesome Icons: Visual clarity and appeal
- Color-coded Cards: Easy identification of different metrics
- Interactive Charts: Hover for detailed information
- Alert Messages: User feedback for all actions
- Proper field types with validation
- Database indexes for performance
- Relationships with appropriate
on_deletebehavior - Model methods and properties for reusability
- Function-based views (FBVs) for clarity
@login_requireddecorator for security- Proper user filtering to ensure data isolation
- Django ORM aggregation (Sum, Count, Annotate)
- Django ModelForms for DRY principle
- Custom widgets for better UX
- Form validation
- Dynamic form field queries based on user
- Template inheritance with
base.html - Context processors for global data
- Template filters for formatting
- DRY principle with reusable components
- CSRF protection enabled
- User-specific queries prevent data leaks
- Password validation
- SQL injection protection via ORM
name: CharField (max 100 characters)user: ForeignKey to User (nullable for predefined)is_predefined: BooleanFieldcreated_at: DateTimeField (auto)- Unique together constraint on (name, user)
user: ForeignKey to Useramount: DecimalField (10 digits, 2 decimal places)category: ForeignKey to Category (nullable, SET_NULL on delete)description: TextField (max 500 characters, optional)date: DateFieldcreated_at,updated_at: DateTimeField (auto)- Indexes on (user, date) and (user, category)
- Budget setting and alerts
- Recurring expenses
- Income tracking
- Multi-currency support
- Mobile app version
- Email notifications
- Advanced analytics and trends
- Data import from CSV
- Expense categories with subcategories
- Tags for expenses
- Search functionality
- Pagination for large datasets
Built with โค๏ธ using Django