Posts tagged ‘django’

(All tags.)

Three more uses for functools.partial() in Django

I remain partial to a plant-scroll.

I remain convinced that Python’s functools.partial() is underappreciated. Following my previous post, here are three more ways to use partial() with Django.


New Testing Features in Django 4.0

Another bunch of testing treasure!

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.


Introducing django-upgrade, a tool for upgrading your Django projects

Giddy-up, we’re going to the future!

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.


Django 3.2 Update for “Speed Up Your Django Tests” Released


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.


How to use Python’s HTTPStatus with Django

Snaily McSnailface says “use HTTPStatus”!

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 http.HTTPStatus enum.


DjangoCon Europe 2021 Sale of “Speed Up Your Django Tests”

Artist’s impression of all the money you can save!

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.


How to Build a Webhook Receiver in Django

Well, I’m hooked.

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.


Using Django Check Constraints to Limit the Range of an IntegerField

Measure twice, cut out bad data.

Another way to use database constraints via Django’s CheckConstraint class.


3 uses for functools.partial in Django

I am rather partial to a plant-scroll.

Python’s functools.partial is a great tool that I feel is underused.


Disabling FLoC, Google’s new advertising technology

Birds of a similar browsing history FLoC together

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.