Django Packages I Have Used and Loved in 2024

It has been almost 4 years since I launched my SaaS business in Django, while fancier Python frameworks have been released since then, Django still remains king of the Python web framework. Thanks to an ever-growing ecosystem of packages and their outstanding stability. Only the most useful and stable packages have made the cut, links to the official package source are included in the title itself. ...

3 January 2025 · 5 min · Gaëtan Grond

8 Django Tips and Tricks Learned Over the Years

After working with Django for more than 4 years both professionally and personally, I have learned a lot of tips and tricks that I wish I knew when I started. In this article I will share some of the most important ones that I have learned over the years. Since Django documentation is very good, I will not share many code snippets, but rather explain the concepts and provide links to the official documentation. All of these tips and tricks came from my own experience, the Django documentation, and Two Scoops of Django book. ...

12 November 2024 · 7 min · Gaëtan Grond

Protecting Data in Django Admin: Preventing Accidental Deletions

The Django admin interface is one of the standout features that make Django such a powerful framework. It allows you to manage your data, customers, and models with ease. However, as with any tool that provides significant control over your application’s data, there’s a need to ensure that sensitive actions like deletions are handled carefully. ...

23 September 2024 · 3 min · Gaëtan Grond

Storing List in Models with Django

Lists or arrays are commonly used data types in programming. However, Django does not have a built-in field for storing lists in models. In a recent project, I needed to store a list of strings in a model, and I had to find an elegant and efficient way to store the list in the database. ...

4 September 2024 · 5 min · Gaëtan Grond

How to Add MFA to Django Allauth in Under 5mn

As of 0.56.0 release of django-allauth (2023-09-07) the support for Multi-Factor Authentication (MFA) has been added. This is great news for the Django developer as it allows you to easily add MFA to your applications, but the documentation is still a bit sparse, and it appears that the feature is not widely known yet. ...

13 March 2024 · 4 min · Gaëtan Grond

Understanding IDOR Vulnerability in Django and how to fix it

Django is by design very secure, most of the common vulnerabilities such as XSS, CSRF, SQL injection, clickjacking are fixed by the simple use of the framework, but there is one that is not fixed by default, and it is the Idor vulnerability. In this article we will see what it is and how to fix it. ...

15 August 2023 · 4 min · Gaëtan Grond

Create a Simple Maintenance Feature in Django

When working with Django for my startup I performed on several occasions very complex migrations and maintenance tasks that required the site not to be accessible for a few minutes and sometimes even hours. Even if the end user is not able to access the site, our team of superusers and admins should be able to access the site and perform the maintenance tasks. ...

5 August 2023 · 5 min · Gaëtan Grond

Secure Your Django Administration with 6 simple steps

One of the most loved features of Django is the built-in administration interface. It allows for an easy way to manage your data and is highly customizable. However, it is also a very common target for attackers. In this article, we will look at some of the most common attacks against the Django administration interface and how to protect against them. ...

3 August 2023 · 8 min · Gaëtan Grond

How to Customize The CSRF Failure View in Django

When working with Django and third party libraries, you may encounter a CSRF error on login or any other form submission. This is because Django requires a CSRF token to be sent with every form submission except GET requests or if the form has the csrf_exempt decorator. During my work with Django, I have encountered this error many times, sometimes due to my own mistakes and sometimes due to third party libraries or user behavior. ...

1 August 2023 · 3 min · Gaëtan Grond