Using Django Check Constraints to Prevent Self-Following

Another way to use Django’s CheckConstraint
class to ensure your data is valid.
Based on my answer to a question on the Django forum.
Another way to use Django’s CheckConstraint
class to ensure your data is valid.
Based on my answer to a question on the Django forum.
IPython is an improved Python shell for interactive use. It has many great features such as syntax highlighting, autocomplete, and powerful “magic commands”. I love it, use it on every project, and use the IPython prompt for examples on my blog.
Read more...It’s now a long-running tradition that each Django release has an associated “code word”. This is used by the release manager in the announcement blog post to describe the list of features coming in the next version.
Read more...Django 3.2 had its first alpha release a couple of weeks ago and the final release will be out in April. It contains a mezcla of new features, which you can check out in the release notes. This post focuses on the changes to testing, a few of which you can get on earlier Django versions with backport packages.
Read more...Yet another use case for creating a database constraint with Django’s CheckConstraint
class.
Here’s another use case for creating a database constraint with Django’s CheckConstraint
class.
I recently optimized a client project’s test suite, and in the process found a test whose runtime had crept up ever since it had been written. The problematic test exercised an import process from a fixed past date until the current day. The test’s runtime therefore grew every day, until it reached over a minute.
Read more...For my new Django project, DB Buddy, I’m using CloudFlare as my CDN. It has a bunch of useful features that would otherwise take extra work, such as DDoS protection, HTML minification, and analytics.
Read more...A client project recently was suffering from an N+1 queries problem in a complicated Django admin page.
Many measures had already been taken to prevent N+1 queries, such as use of django-auto-prefetch and some manually tuned select_related()
/ prefetch_related()
calls.
The remaining N+1 in question was a bit resistant to those methods because it came through several layers of admin code and many-to-many fields, making it harder than normal to find the place to modify the QuerySet
construction.
If you start the development server on a Django project, it looks something like this:
Read more...