Django Mini Task — Task Manager
Time Limit: 15 minutes
Objective:
Build a basic Task Manager system using pure Django (no Django REST Framework). The
system should allow a logged-in user to create and view their own tasks.
🔹 1. Model
Create a Task model with the following fields:
● id: AutoField (primary key, default in Django)
● user: ForeignKey to Django’s built-in User model
● title: CharField (max_length = 255)
● description: TextField (optional, blank=True)
● created_at: DateTimeField (auto_now_add=True)
🔹 2. Views
Create two views, both protected using @login_required:
a. Task List View — /tasks/
● Display a list of tasks belonging to the currently logged-in user.
● Show only: title and created_at.
b. Task Create View — /tasks/create/
● Display a form to create a new task (title, description).
● On submission, assign request.user automatically to the task.
● On success, redirect to task list view.
● (Bonus) Show a success message using Django’s messages framework.
🔹 3. Templates
Use simple, clean templates:
● task_list.html: Lists all tasks of the logged-in user.
● task_form.html: Form to create a new task.
🔹 4. URLs
Define the following URL patterns:
URL View
/tasks/ Task List View
/tasks/crea Task Create
te/ View
🔹 5. Rules
● Protect views using @login_required.
● Users should only see their own tasks.
● No edit/delete required.
● Bonus: Use Django messages for success feedback.
Submission Checklist
● Task Model
● Task List and Create Views
● Basic Templates
● Working URLs
● Login protection and user scoping
● Bonus: Success message after task creation