Django 4.0 had its first alpha release last week and the final release should be out in December. It contains an abundance of new features, which you can check out in the release notes. In this post we’ll look at the changes to testing in a bit more depth.
Django deprecates a small list of features with every feature release, requiring us to update our projects, which can be monotonous. Today I’m announcing a new tool I’ve created, django-upgrade, that automates some of this drudgery for us all.
I released my book “Speed Up Your Django Tests” over a year ago, in May 2020. Since then, we’ve seen two major Django releases, including a whole bunch of test-related changes, some of which I worked on as part of the book.
A “magic number” is the anti-pattern of using a number directly rather than storing it in a descriptive variable name.
In web code HTTP status codes are often used as magic numbers, perhaps because web developers memorize common codes such as 200 and 404.
In Python, we can avoid such magic with descriptive references from the standard library’s
I released my book Speed Up your Django Tests (SUYDT) just over a year ago, on the 18th May. It’s had a great reception, with 379 customers so far, many writing in to say how it has improved their test suites’ performance and readability.
A common way to receive data in a web application is with a webhook. The external system pushes data to yours with an HTTP request.
Another way to use database constraints via Django’s
functools.partial is a great tool that I feel is underused.
Google has started rolling out FLoC, currently to 0.5% of Chrome users, and some sites are already disabling it. In this post we’ll cover what FLoC is, who’s disabling it, why, and how to do so on a Django site.