Book Image

Django 4 for the Impatient

By : Greg Lim, Daniel Correa
Book Image

Django 4 for the Impatient

By: Greg Lim, Daniel Correa

Overview of this book

Learning Django can be a tricky and time-consuming activity. There are hundreds of tutorials, loads of documentation, and many explanations that are hard to digest. However, this book enables you to use and learn Django in just a couple of days. In this book, you’ll go on a fun, hands-on, and pragmatic journey to learn Django full stack development. You'll start building your first Django app within minutes. You'll be provided with short explanations and a practical approach that cover some of the most important Django features, such as Django Apps’ structure, URLs, views, templates, models, CSS inclusion, image storage, authentication and authorization, Django admin panel, and many more. You'll also use Django to develop a movies review app and deploy it to the internet. By the end of this book, you'll be able to build and deploy your own Django web applications.
Table of Contents (14 chapters)

Adding a search form

We will add a search form on our home page for users to search for movies. Let's get a Form component from getbootstrap. At, under Docs, go to Forms | Overview (as shown in Figure 4.8):

Figure 4.8 – Bootstrap forms

In the Overview section, you can copy the markup (as shown in Figure 4.9) and paste it inside the home.html template file. This is very useful because you will have a skeleton to design HTML forms with Bootstrap.

Figure 4.9 – Bootstrap forms

Because we don't need much information from the previous form (such as password and checkbox), we refine the previous HTML code to only contain the Search for Movie field and a Search button. Add the following in bold to the home.html template file:

  <div class="container">
    <form action="">
      <div class...