Tips for Django

Styling Django Forms with django-crispy-forms

По умолчанию в Django не предусмотрено никаких методов стилизации форм, из-за чего приходится тратить много сил и драгоценного времени, чтобы красиво оформить форму. django-crispy-forms решает эту проблему.

Easily Install Django 4.2: A Quick Guide

The goal of this article is to get you started using Django to build a web application as quickly as possible, and set you on the road to a production-ready application. For demonstration purposes, we’ll be creating a simple blog for our company called Foo.

Testing emails in Django

Sending email messages from a web app often seems like throwing stones into a black hole. You create a message, pass it to a mail send function and hope for the best. You don't control an inbox and mail server, so this whole process happens somewhere in between, and you hope it just works.

Profiling & Optimizing Bottlenecks In Django

In the previous article, we have learnt where to start with performance optimization in django application and find out which APIs to optimize first. In this article, we will learn how to optimize those selected APIs from the application.

What Is The Difference between AbstractUser and AbstractBaseUser in Django ?

It is important to understand the difference between AbstractUser and AbstractBaseUser in Django, this will help you make the right decision on which one to use when you are starting a Django project.

Creating a Custom User Model in Django

How do I fully replace the username field with an email field for Django authentication? This post explains step-by-step how to create a custom User model in Django so that an email address can be used as the primary user identifier instead of a username for authentication.

Tips On Writing Data Migrations in Django Application

In a Django application, when schema changes Django automatically generates a migration file for the schema changes. We can write additional migrations to change data.

Query by Sum from Linked Model

It was necessary here to find a discrepancy between the amount of the Payment payment and the amount of the PaymentItem elements associated with it. This is solved with a simple annotation.

Custom Model User

Every new Django project must use a custom User model. The official Django documentation says it's "highly recommended", but I'll go one step further and say without hesitation: you're crazy if you haven't used a custom model before.

Finding performance bottlenecks in a Django project

When optimizing the performance of a web application, a common mistake is to start by optimizing the slowest page (or API). In addition to taking into account the response time, we also have to take into account the traffic it receives in order to determine the optimization order. In this article, we'll walk through a Django web application, find performance bottlenecks, and then start optimizing them for better performance.

Viewing Django SQL Queries

Django ORM makes it easy to interact with the database. To understand what's going on behind the scenes or see SQL performance, we can record all the SQL queries that are being executed. In this article, we will see different ways to achieve this.

New middleware format in Django 2

MIddleware are used to modify an incoming request object into a view or to modify a response object returned from a view. They allow us to modify requests/responses globally.

Template structure in Django

There are two main ways to organize Django's template structure: application-level and custom, project-level, which is specified in setting.py.

Imports in Django

Importing modules is an essential part of Python and Django development. These tips will help you write good and beautiful code.

User permissions in Django

Configuring user rights is one of the main parts when developing projects and can quickly become quite complex. Let's break down the main techniques on the example of a blog.

Designing Models in Django

In this article, I would like to share my experience and help in designing and formatting your Django code. Hopefully you are already using PEP8, but it is also a good tone to use Django's code formatting style guidelines.

A simple decorator to find out the execution time of a function

Want to quickly check how long a function in a project takes to complete? To do this, you can use a simple decorator.

Getting the name (Verbose Name) of a model or object from a template

How to get model or object name in Django templates.