Category: Django

  • Django Form Validation

    Django provides built-in methods to validate form data automatically. Django forms submit only if it contains CSRF tokens. It uses uses a clean and easy approach to validate data. The is_valid() method is used to perform validation for each field of the form, it is defined in Django Form class. It returns True if data is valid…

  • Django Forms

    Django provides a Form class which is used to create HTML forms. It describes a form and how it works and appears. It is similar to the ModelForm class that creates a form by using the Model, but it does not require the Model. Each field of the form class map to the HTML form <input> element and each…

  • Django Model Form

    It is a class which is used to create an HTML form by using the Model. It is an efficient way to create a form without writing HTML code. Django automatically does it for us to reduce the application development time. For example, suppose we have a model containing various fields, we don’t need to…

  • Django Static Files Handling

    In a web application, apart from business logic and data handling, we also need to handle and manage static resources like CSS, JavaScript, images etc. It is important to manage these resources so that it does not affect our application performance. Django deals with it very efficiently and provides a convenient manner to use resources.…

  • Django URL Mapping

    Well, till here, we have learned to create a model, view, and template. Now, we will learn about the routing of application. Since Django is a web application framework, it gets user requests by URL locater and responds back. To handle URL, django.urls module is used by the framework. Let’s open the file urls.py of the project and see…

  • Django Templates

    Django provides a convenient way to generate dynamic HTML pages by using its template system. A template consists of static parts of the desired HTML output as well as some special syntax describing how dynamic content will be inserted. Why Django Template? In HTML file, we can’t write python code because the code is only…

  • Django Views

    A view is a place where we put our business logic of the application. The view is a python function which is used to perform some business logic and return a response to the user. This response can be the HTML contents of a Web page, or a redirect, or a 404 error. All the…

  • Django Model

    In Django, a model is a class which is used to contain essential fields and methods. Each model class maps to a single table in the database. Django Model is a subclass of django.db.models.Model and each field of the model class represents a database field (column). Django provides us a database-abstraction API which allows us to create,…

  • Django MVT

    The MVT (Model View Template) is a software design pattern. It is a collection of three important components Model View and Template. The Model helps to handle database. It is a data access layer which handles the data. The Template is a presentation layer which handles User Interface part completely. The View is used to…

  • Django App

    In the previous topics, we have seen a procedure to create a Django project. Now, in this topic, we will create app inside the created project. Django application consists of project and app, it also generates an automatic base directory for the app, so we can focus on writing code (business logic) rather than creating…