0% found this document useful (0 votes)
76 views5 pages

Django Views

This document provides an overview of Django views and how to get started with them. It discusses that Django views are functions called when a request is made to a certain URL. An example view is provided that returns the current datetime. Installation and setup instructions are also mentioned. The document is intended to introduce developers to Django views and provide initial content for related topics.

Uploaded by

amiesheibani
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)
76 views5 pages

Django Views

This document provides an overview of Django views and how to get started with them. It discusses that Django views are functions called when a request is made to a certain URL. An example view is provided that returns the current datetime. Installation and setup instructions are also mentioned. The document is intended to introduce developers to Django views and provide initial content for related topics.

Uploaded by

amiesheibani
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

django-views

#django-
views
Table of Contents
About 1

Chapter 1: Getting started with django-views 2

Remarks 2

Examples 2

Installation or Setup 2

Django Views 2

Credits 3
About
You can share this PDF with anyone you feel could benefit from it, downloaded the latest version
from: django-views

It is an unofficial and free django-views ebook created for educational purposes. All the content is
extracted from Stack Overflow Documentation, which is written by many hardworking individuals at
Stack Overflow. It is neither affiliated with Stack Overflow nor official django-views.

The content is released under Creative Commons BY-SA, and the list of contributors to each
chapter are provided in the credits section at the end of this book. Images may be copyright of
their respective owners unless otherwise specified. All trademarks and registered trademarks are
the property of their respective company owners.

Use the content presented in this book at your own risk; it is not guaranteed to be correct nor
accurate, please send your feedback and corrections to info@[Link]

[Link] 1
Chapter 1: Getting started with django-views
Remarks
This section provides an overview of what django-views is, and why a developer might want to use
it.

It should also mention any large subjects within django-views, and link out to the related topics.
Since the Documentation for django-views is new, you may need to create initial versions of those
related topics.

Examples
Installation or Setup

Detailed instructions on getting django-views set up or installed.

Django Views

Django Views are simply the functions that get called when a request is made to a certain URLs.
URL patterns are written in [Link] file, each URL regex is given a function(Django view) from a
[Link], so when a request is made, that function gets the call, with the HTTP request object, and
then you can do whatever fun you want to do with that request.

A simple example of view,

from [Link] import HttpResponse


import datetime

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

Calling the above view from a URL would return the current time, everytime you call the URL
assigned to this view.
The request object has many parameters related to the HTTP request you get, like headers,
request type and more. Read the official doc with more detailed examples.

Read Getting started with django-views online: [Link]


views/topic/9728/getting-started-with-django-views

[Link] 2
Credits
S.
Chapters Contributors
No

Getting started with


1 Community, Vatsal Parekh
django-views

[Link] 3

You might also like