0% found this document useful (0 votes)
3 views

Django Mini Task — Task Manager

The document outlines a Django Mini Task to build a basic Task Manager system that allows logged-in users to create and view their own tasks. It specifies the creation of a Task model, two protected views for listing and creating tasks, simple templates for user interaction, and URL patterns for navigation. Additionally, it emphasizes user authentication and task ownership, with a bonus for implementing success messages upon task creation.

Uploaded by

dheerajmourya90
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Django Mini Task — Task Manager

The document outlines a Django Mini Task to build a basic Task Manager system that allows logged-in users to create and view their own tasks. It specifies the creation of a Task model, two protected views for listing and creating tasks, simple templates for user interaction, and URL patterns for navigation. Additionally, it emphasizes user authentication and task ownership, with a bonus for implementing success messages upon task creation.

Uploaded by

dheerajmourya90
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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​

You might also like