π I Built a Django User Management System in One Day (And Here's What I Learned)
From zero to fully functional β registration, login, profile, verification, and even testing β all before 6PM!
Hi Devs!
I recently had to build a User Management System using Django β with a tight deadline. The task? Build a complete project with registration, login, mock verification, profile management, an admin panel, and even write unit tests β all in a single day. π
So I brewed some strong tea β, opened Pycharm, and dove in.
Here's how it went down (and what you can learn from it too).
π οΈ The Tech Stack
- Python 3.11+
- Django 5.x
- SQLite (default for development)
- HTML + Bootstrap via Django Crispy Forms
- Git + GitHub (with a 10-commit rule!)
- Console email backend for mocking verification
π Features I Implemented
- β User Registration
- β Login / Logout
- β Email Verification (mocked in console)
- β Profile View / Edit
- β Change Password
- β Admin Panel for managing users
- β Tests for models and views
And yes β everything works π₯³
π Project Structure
My Django project followed this structure:
user_mgt/
βββ accounts/ # Custom user app
β βββ models.py # Extended User if needed
β βββ views.py # Auth + profile views
β βββ forms.py # Crispy-powered forms
β βββ tests.py # Unit tests
βββ user_mgt/
β βββ settings.py # Configured apps, email, templates
βββ templates/
β βββ registration/ # login.html, register.html, etc.
βββ static/ # CSS, images, etc.
βββ manage.py
βββ README.md
I didnβt use any fancy custom user model yet, but made the app scalable to add it later.
π§± Step-by-Step Breakdown
1. Project Setup π§°
django-admin startproject user_mgt
cd user_mgt
python manage.py startapp accounts
I added accounts
, crispy_forms
, and set up templates and static directories in settings.py
.
2. User Registration π
I created a RegisterForm
that extended UserCreationForm
, then used a class-based view to render it. Thanks to crispy-forms, it looked great with minimal CSS.
class RegisterView(View):
def get(self, request):
form = RegisterForm()
return render(request, 'registration/register.html', {'form': form})
def post(self, request):
form = RegisterForm(request.POST)
if form.is_valid():
user = form.save()
# send email here (mocked)
return redirect('login')
return render(request, 'registration/register.html', {'form': form})
3. Email Verification (Mocked) π¬
I used Django's built-in console backend:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
So when a user signs up, it "sends" a verification link in the console β simple, elegant, and demo-ready.
4. Profile Management π€
- Profile View: Display user details
- Profile Edit: Allow users to update name, email, etc.
- Password Change: Using Djangoβs built-in views
Each normal user could only view and edit their profile β nothing more. Security first. π
5. Admin Panel π οΈ
Djangoβs admin is magic πͺ. I just registered my User
model, customized the display, and boom β I could view and edit all users easily.
6. Unit Testing π§ͺ
I wrote simple tests for:
- β Model creation
- β View rendering for login and registration
class UserTestCase(TestCase):
def test_user_creation(self):
user = User.objects.create_user(username="dee", password="123asd45")
self.assertEqual(user.username, "dee")
Small but mighty!
π€― Lessons Learned
- Django does a LOT for you. From auth to admin to email, it's a full-stack powerhouse.
- Crispy Forms = π₯ Makes your forms look instantly professional.
- You don't need to reinvent everything β use built-in tools first, then customize.
- Console email is your friend during development.
- Writing tests early makes you more confident β even if they're simple.
β Final Deliverables
- βοΈ GitHub repo with <10 commits
- βοΈ README with setup + screenshots
- βοΈ Working registration, login, profile, and admin
- βοΈ Tests added
π¦ Whatβs Next?
Iβm planning to:
- Deploy this on Render or Railway
- Add a Docker setup for easier deployment
- Maybe write a Part 2: Advanced User Roles + Permissions!
π Check Out the Code
π GitHub Repository
π§ Final Words
This project pushed me to:
- Think fast π§
- Code clean π§Ή
- Write meaningful commits π
- And learn a LOT about Django authentication in just one day
I hope this walkthrough helps you if you're learning Django, or rushing to finish your own project like I was π .
π¬ Questions? Suggestions?
Drop them below or ping me on GitHub β happy to connect and grow together as devs! π
Top comments (0)