Event sourcing in Django

Posted on Thu 05 January 2017 in Django • Tagged with django, models, event sourcing, audit trail

Django comes with batteries included to make CRUD (create, read, update, delete) operations easy. But it also makes deleting data easy, causing you to lose historical data. Old data in your business critical models are valuable, and you never know when you'll want an audit trail. Use event sourcing to ensure you never lose your data's history.


Continue reading

3 ways of testing Django views

Posted on Mon 02 January 2017 in Django • Tagged with django, testing, views

I tried 3 different ways of testing a Django view. These are my thoughts.


Continue reading

Use ptipython, a better Python shell

Posted on Wed 21 December 2016 in Python • Tagged with python, django

Most Python developers use a shell, or REPL (Read-Evaluate-Print-Loop) to quickly try out small bits of code and also for quick and dirty debugging. Did you know there are other options apart from the default Python shell?


Continue reading

Writing readable queries in Django

Posted on Sun 18 December 2016 in Django • Tagged with django, querysets

Queries in Django can get complicated and difficult to read. Here's how to write them in a way that doesn't confuse other programmers.


Continue reading