Django’s views are the information brokers of a Django application. A view sources data from your database (or an external data source or service) and delivers it to a template. For a web application, the view delivers webpage content and templates; for a RESTful API this content could be formatted JSON data.

    The view decides what data gets delivered to the template—either by acting on input from the user or in response to other business logic and internal processes. Each Django view performs a specific function and has an associated template.

    Views are represented by either a Python function or a method of a Python class. In the early days of Django, there were only function-based views, but, as Django has grown over the years, Django’s developers added class-based views.

    Class-based views add extensibility to Django’s views. Django also has many built-in class-based views that make creating common views (like displaying a list of articles) easier to implement. Don’t worry too much about the differences between function- and class-based views now, we will cover both in more detail later in the book.

    We covered the basics of Django’s models in Chapter 4. In this chapter, we will take a detailed look at the basics of Django’s views without getting into any detail on how views interact with models and templates. To help you grasp how views work at a fundamental level, I will show you how they work using simple HTML responses. In the next chapter, we’ll cover the basics of Django’s templates, and we’ll cover class-based views in Chapter 13.