Are you searching for how you can write a VIEW in Django? We have shared below program to write a VIEW in Django.
1 2 3 4 5 6 7 | 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) |
Output
1 | Returns the current date and time, as an HTML document |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.