A django based doctor-patient signup and dashboard.
working video - https://www.loom.com/share/4888d0595785424eb8634df5a739bdf8
python manage.py runserverServer will be available at: http://127.0.0.1:8000/
python manage.py test signX -v 2Step 1: Signup as Patient
- Navigate to
http://127.0.0.1:8000/signup/ - Fill the form with:
- User Type: Patient
- First Name:
John - Last Name:
Doe - Username:
johndoe - Email:
john@example.com - Profile Picture: (optional - upload any image)
- Address Line 1:
123 Main Street - City:
New York - State:
NY - Pincode:
10001 - Password:
SecurePass123 - Confirm Password:
SecurePass123
- Click "Create Account"
- Expected Result: Redirected to login page with success message
Step 2: Login as Patient
- On login page, fill:
- User Type: Patient
- Username:
johndoe - Password:
SecurePass123
- Click "Login"
- Expected Result: Redirected to patient dashboard showing all entered information
Step 1: Signup as Doctor
- Navigate to
http://127.0.0.1:8000/signup/ - Fill the form with:
- User Type: Doctor
- First Name:
Jane - Last Name:
Smith - Username:
janesmith - Email:
jane@example.com - Profile Picture: (optional)
- Address Line 1:
456 Medical Avenue - City:
Los Angeles - State:
CA - Pincode:
90001 - Password:
DoctorPass123 - Confirm Password:
DoctorPass123
- Click "Create Account"
- Expected Result: Redirected to login page with success message
Step 2: Login as Doctor
- On login page, fill:
- User Type: Doctor
- Username:
janesmith - Password:
DoctorPass123
- Click "Login"
- Expected Result: Redirected to doctor dashboard showing all entered information
Test 3.1: Password Mismatch
- Go to signup page
- Enter all fields correctly
- Enter Password:
Pass123 - Enter Confirm Password:
Pass456(different) - Expected Result:
- Red error message appears: "✗ Passwords do not match"
- Form submission is blocked
Test 3.2: Duplicate Username
- Signup with username
johndoe(from Scenario 1) - Try to signup again with same username
- Expected Result: Error message "Username already exists."
Test 3.3: Duplicate Email
- Signup with email
john@example.com(from Scenario 1) - Try to signup with different username but same email
- Expected Result: Error message "Email already exists."
Test 3.4: Invalid Login Credentials
- Go to login page
- Enter username:
johndoe - Enter password:
WrongPassword - Select User Type: Patient
- Click "Login"
- Expected Result: Error message "Invalid username or password."
Test 4.1: Patient Cannot Access Doctor Dashboard
- Login as patient (from Scenario 1)
- Manually navigate to
http://127.0.0.1:8000/doctor-dashboard/ - Expected Result: Redirected to login page
Test 4.2: Doctor Cannot Access Patient Dashboard
- Login as doctor (from Scenario 2)
- Manually navigate to
http://127.0.0.1:8000/patient-dashboard/ - Expected Result: Redirected to login page
Test 4.3: Wrong User Type Login
- Go to login page
- Enter patient credentials (johndoe / SecurePass123)
- Select User Type: Doctor (wrong type)
- Click "Login"
- Expected Result: Error message "This account is not registered as a Doctor."
Test 5.1: Logout Functionality
- Login as any user (patient or doctor)
- Click "Logout" button in navigation bar
- Expected Result:
- Redirected to home page
- Success message "You have been logged out successfully."
- Navigation bar shows "Login" and "Sign Up" links
Test 6.1: Home Page
- Navigate to
http://127.0.0.1:8000/ - Expected Result:
- Welcome message displayed
- Two cards for "For Doctors" and "For Patients"
- Links to signup and login
Test 6.2: Navigation Bar
- When logged out: Shows "Login" and "Sign Up" links
- When logged in: Shows "Welcome, [Username]" and "Logout" link
- Click logo to return to home page
Test 6.3: Profile Picture Display
- Signup with a profile picture
- Login and view dashboard
- Expected Result: Profile picture is displayed in the dashboard
python manage.py test signX -v 2Found 25 test(s).
...
Ran 25 tests in ~30s
OK
- ✅ Address Model Tests (2)
- ✅ Patient Model Tests (2)
- ✅ Doctor Model Tests (2)
- ✅ Signup View Tests (6)
- ✅ Login View Tests (5)
- ✅ Dashboard View Tests (6)
- ✅ Logout View Tests (2)
- Create superuser:
python manage.py createsuperuser
- Navigate to
http://127.0.0.1:8000/admin/ - Login with superuser credentials
- View all Patients
- View all Doctors
- View all Addresses
- Add/Edit/Delete users and profiles
- Search by name, username, city, state
Solution: Run migrations
python manage.py migrateSolution: Ensure media files are configured in settings.py and server is running
Solution: Collect static files
python manage.py collectstaticSolution: Ensure database is clean
python manage.py flush
python manage.py migrate- All tests complete in ~30 seconds
- Database: SQLite3 (suitable for development)
- Media files stored in
media/directory - Static files served via CDN (Bootstrap)
✅ Passwords are hashed using Django's default hasher
✅ CSRF tokens on all forms
✅ Login required decorators on protected views
✅ User type verification prevents unauthorized access
✅ Unique constraints on username and email
✅ SQL injection prevention via ORM
Happy Testing! 🎉