My most favorite django packages

I use Django every single day at my work. Due to long time user of Django, I have a few packages that I love and use most of the time.

django-constance #

I like how Django manages settings. But often time I want a way to store settings in database. At first, I used to create a Settings model, and keep attr_key, attr_val to store configurations that I want to change dynamically. Then I found this gem. It lets you store settings in database, automatically casts to appropriate type & supports using configuration in template too. It also lets you define your own custom field types for settings. On top of that, you can use Redis to store your configuration out of the box. All my Django installations have this package installed.

django-allauth #

After a fresh Django installation, if my first task is to add django-constance, the second task is to override default User class & use django-allauth for authentication. And I do it before the first migration command. Django-allauth is an amazing authentication package, which lets me use email instead of username with just a few settings. It also supports a wide variety of social logins.

django-tables2 #

If I have to create a table with pagination & filter in Django, I use django-tables2. It saves me tons of time from writing boilerplate code and repeating same style code over and over for each model / table. With django-tables2 generating table with pagination is super easy. It also supports my another favorite package — django-filter for generic filters. It also supports bootstrap 3 & 4 as table & pagination template by default.

django-filter #

Filtering a list or query set were not that easy before django-filter. Actually it was easy but time-consuming. You had to write lots of code which can be replaced by a generic filtering system. And that generic filtering system is django-filter. With Django filter you can simply define which fields are going to be used as filter. You can also customize the behavior or create custom filtering field. Django-filter is a must for me wherever I use Django-tables2.

django-crispy-forms #

Django form is powerful. But Django-crispy-forms makes it extremely powerful. Imagine defining the form layout right from your form class. It also has bootstrap support, so you define your form based on bootstrap grid right in your python code, which is pretty useful to me.

django-widget-tweaks #

Django-widget-tweaks also a helper for Django form. But it works on template level. It lets you change classes or other attribute of form right on template via its powerful template tags. I use both django-widget-tweaks & django-crispy-forms based on situation.