Brad's Blog

Published: 2015-09-30

Django Admin Filters from ArrayFields

admin array arrayfield django filter postgresql

I've written before about the cool ArrayField support in Django, and this is another such post. In this one, we'll take a look and see how to turn your model's ArrayField values into filters in the admin. To start out, let's assume we have a model that contains a simple title (a CharField) and some keywords (an ArrayField). It might look something like this: from django.db import models class Item(models.Model): title = models.CharField ...

Published: 2015-08-26

A django iconbool filter

django filter python

Django's template laguage includes a lot of really useful built-in tags and filters, but sometimes you just need to build your own. There are many reasons why you might want to do this, but I'm lazy, and I like to build filters and tags that let me take shortcuts in the template. Here's one example of a simple filter that let's me be lazy: an iconbool filter. Motivation I really like Font-Awesome, and any time I ...