Blog Info | Adam Johnson |
---|---|
Blog website | Link |
Nov. 14, 2022 » Adam Johnson » [Archived Version]
Python 3.11 only made one change to unittest, but it’s a good one: context manager methods. These methods can simplify setup and teardown logic in many cases, such as dynamic use of unittest.mock. In this post we’ll look at a couple fo examples using the new …
Read MoreOct. 25, 2022 » Adam Johnson » [Archived Version]
I just released version 1.11.0 of django-upgrade, a tool for automatically upgrading your Django project code. This release contains a lot of new features and fixes, thanks to new contributors including those at the Djangocon Europe sprints. Let’s look at the top changes. New admin.site.register …
Read MoreOct. 25, 2022 » Adam Johnson » [Archived Version]
I just released version 1.11.0 of django-upgrade, a tool for automatically upgrading your Django project code. This release contains a lot of new features and fixes, thanks to new contributors including those at the Djangocon Europe sprints. Let’s look at the top changes. New admin.site.register …
Read MoreOct. 20, 2022 » Adam Johnson » [Archived Version]
The Django 4.1 release notes feature this short, innocent-looking note: On PostgreSQL, AutoField, BigAutoField, and SmallAutoField are now created as identity columns rather than serial columns with sequences. In this post, we’ll expand on what this means, why you might want to update existing columns from serial types …
Read MoreOct. 20, 2022 » Adam Johnson » [Archived Version]
The Django 4.1 release notes feature this short, innocent-looking note: On PostgreSQL, AutoField, BigAutoField, and SmallAutoField are now created as identity columns rather than serial columns with sequences. In this post, we’ll expand on what this means, why you might want to update existing columns from serial types …
Read MoreOct. 12, 2022 » Adam Johnson » [Archived Version]
In data import processes it’s often useful to have a “dry run” mode, that runs through the process but doesn’t actually save the data. This can allow you to check for validity and gather statistics, such as how many records already exist in the database. In this post …
Read MoreOct. 12, 2022 » Adam Johnson » [Archived Version]
In data import processes it’s often useful to have a “dry run” mode, that runs through the process but doesn’t actually save the data. This can allow you to check for validity and gather statistics, such as how many records already exist in the database. In this post …
Read MoreOct. 5, 2022 » Adam Johnson » [Archived Version]
You want to pass your data from your Django view to JavaScript, in your template. And, you want to do it securely, with no risk of accidentally allowing malicious code injection. Great, this is the post for you! We’re going to look at the problems with templating JavaScript, then …
Read MoreOct. 5, 2022 » Adam Johnson » [Archived Version]
You want to pass your data from your Django view to JavaScript, in your template. And, you want to do it securely, with no risk of accidentally allowing malicious code injection. Great, this is the post for you! We’re going to look at the problems with templating JavaScript, then …
Read MoreAug. 21, 2022 » Adam Johnson » [Archived Version]
Django’s transaction.on_commit() allows you to run a function after the current database transaction is committed. This is useful to ensure that actions with external services, like sending emails, don’t run until the relevant data is definitely saved. Although Django’s documentation says that on_commit() takes a “function …
Read More