Blog: Haki Benita

How to Manage Concurrency in Django Models

July 6, 2017 » Haki Benita » [Archived Version]

The days of desktop systems serving single users are long gone. Web applications nowadays are serving millions of users at the same time. With many users comes a wide range of new problems: concurrency problems. In this article we describe two approaches for managing concurrency in Django models.

Read More

5 Ways to Make Django Admin Safer

June 8, 2017 » Haki Benita » [Archived Version]

With great power comes great responsibility. The more powerful your Django admin is, the safer it should be. Making a Django admin safer and more secure doesn't have to be hard - you just have to pay attention. In this article I present 5 ways to protect the Django Admin from human errors and attackers.

Read More

All You Need To Know About Prefetching in Django

April 28, 2017 » Haki Benita » [Archived Version]

A rundown of all the ways you can use Prefetch to speed up queries in Django.

Read More

How to Turn Django Admin Into a Lightweight Dashboard

March 30, 2017 » Haki Benita » [Archived Version]

Django Admin is a powerful tool for managing data in your app. However, it was not designed with summary tables and charts in mind. Luckily, the developers of Django Admin made it easy for us to customize. We are going to turn Django Admin into a dashboard by adding a chart and a summary table.

Read More

How to Test Django Signals Like a Pro

Feb. 17, 2017 » Haki Benita » [Archived Version]

Django signals are extremely useful for decoupling modules. They allow a low-level Django app to send events for other apps to handle without creating a direct dependency. Signals are easy to set up, but harder to test. In this article we implement a context manager for testing Django signals, step by step.

Read More

How to Add Custom Action Buttons to Django Admin

Nov. 1, 2016 » Haki Benita » [Archived Version]

The built-in admin actions, operate on a queryset and are hidden in a dropbox menu. They are not suitable for most use cases. In this article we are going to add custom action buttons for each row in a Django Admin list view.

Read More

Bullet Proofing Django Models

Oct. 25, 2016 » Haki Benita » [Archived Version]

We recently added a bank account like functionality into one of our products. During the development we encountered some textbook problems and I thought it can be a good opportunity to go over some of the patterns we use in our Django models.

Read More

Things You Must Know About Django Admin As Your App Gets Bigger

Aug. 4, 2016 » Haki Benita » [Archived Version]

The Django admin is a very powerful tool. We use it for day to day operations, browsing data and support. As we grew some of our projects from zero to 100K+ users we started experiencing some of Django's admin pain points - long response times and heavy load on the database.

Read More