User Authentication Based Django App
  • Python Django
  • Basic Python Virtual Environment Setup
  • Project Set Up
  • Model-View-Templates Implementation
  • Model & Django Admin Area
  • View
    • Types of Views in Django
    • Project Todo Views
  • Django Templates
  • Todo App
    • DEMO: Workflow of Todo App
    • Base Template for Todo App
    • Registration Module
    • Login Module
    • Linking Login and Registration page
    • Task List User Authentication
    • Task Reordering
    • Logout Module
    • Task Create Module
    • Task Update
    • Task Delete
Powered by GitBook
On this page
  • 1. Create a urls for view functions in TodoList > todo > urls.py
  • 2. Write a view function for above mentioned urls

Model-View-Templates Implementation

PreviousProject Set UpNextModel & Django Admin Area

Last updated 1 year ago

1. Create a urls for view functions in TodoList > todo > urls.py

Type the below code in urls.py (refer Fig. 2.0)

from django.urls import path
from . import views

urlpatterns = [
    path('', views.Home.as_view(), name='home'),
    # Add other URL patterns as needed
]

2. Write a view function for above mentioned urls

Type the below code in views.py (refer Fig. 2.1)

from django.shortcuts import render
from django.http import HttpResponse
from django.views import View

class Home(View):
    def get(self, request):
        return HttpResponse("Hello, Django!")

Output:

Fig. 2.0 todo > urls.py
Fig. 2.1
Fig. 2.2 output