from views import django code example

Example 1: import views

from django.shortcuts import render, redirect
from django.urls import reverse_lazy 
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from .forms import UserRegistrationForm
from django.views.generic import (CreateView, ListView, DetailView, UpdateView, DeleteView, TemplateView)

Example 2: views django

from django.http import HttpResponse
import datetime

def current_datetime(request):
    now = datetime.datetime.now()
    html = "<html><body>It is now %s.</body></html>" % now
    return HttpResponse(html)