Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
PostgreSQL: Full text search with the “websearch” syntax
PostgreSQL’s powerful full text search feature supports several query syntaxes. Of these, a website search feature should typically pick the websearch syntax. websearch copies some features from popular search engines, as covered below, offering familiar short syntax to users. It is also forgiving and will never raise a syntax error for user input, whilst other syntaxes can. The syntax The websearch syntax discards stop words, such as “a” or “the” in English, then parses according to these rules: Individual words match independently. Double-quoted phrases match as a single unit. The word or (case-insensitive) specifies an “or” condition between two words or phrases. A - prefix specifies to not match the following word or phrase. The below table gives some examples mapping queries to their tsquery representations. Query tsquery Notes the donkey 'donkey' Stop word “the” removed the blue donkey 'blue' & 'donkey' The two words can appear in any order, with any number of words between "blue donkey" 'blue' <-> 'donkey' The words must appear together in the given order "the donkey" 'donkey' Stop words are removed within quotes donkey or mule 'donkey' | 'mule' Either word will match "blue donkey" or "red mule" 'blue' <-> 'donkey' | 'red' <-> … -
My 2023 in review
The review of my 2023, trying to remember all the things done in this year, in which more than anyone I met many fantastic people and visited new countries. -
Boost Your DX bundle deal update
My two “Boost Your DX” books are available in a bundle deal, saving $10 compared to buying them separately. Great for improving your Django and Git skills at the same time. Buy the bundle on Gumroad This offer does not apply to team licenses. I initially created a bundle deal in October, shortly after releasing Boost Your Git DX. However, it was done with a “hack” using Gumroad’s upsells feature, meaning you had to try to buy one book first to see the offer. This option was less discoverable and didn’t stack with the regional discount for lower-income countries. On Christmas day, Gumroad released a true bundle feature. I have taken advantage of this to create the bundle product page. Enjoy buying for yourself or gifting to others, and let me know if you encounter any issues. May your developer experience always improve, —Adam -
Django News - No news means more articles! - Dec 29th 2023
Updates to Django Last week we had 12 pull requests merged into Django by 7 different contributors - including 3 first time contributors! Congratulations to Amin Shah Gilani, Nicolas Lupien, and Rapha S for having their first commits merged into Django - welcome on board! Here are the key updates from last week: Django's support of geospatial libraries has been updated. Support for PostGIS 2.5, PROJ < 6 and GDAL 2.4 is removed from 5.1. Confirmed support for GDAL 3.8. A regression in Django 5.0 has been fixed in 5.0.1 where querysets referenced incorrect field names from FilteredRelation(). Django supports oracledb 2.0.0 from Django 5.0.1 Django Newsletter Sponsored Ad Sick of performance issues? Enter Scout's APM tool for Python apps. Easily pinpoint and fix slowdowns with intelligent tracing logic. Optimize performance hassle-free, delighting your users. Try us out for free! ter.li Articles Fine Tuning Python WSGI and ASGI applications for Flask, Django, and FastAPI Exploring strategies for optimal Gunicorn, Uvicorn and Hypercorn configurations for Flask, Django, and FastAPI. github.io django-json-schema-editor Author's description of django-json-schema-editor, an open source JSON editing component for Django that uses JSON schema for validation and supports editing arrays of objects in a tabular format. 406.ch Django: … -
Django: Detect the global privacy control signal
Global Privacy Control (GPC) is a specification for web browsers to signal website operators not to share or sell the user’s data. This signal is intended to exercise legal data privacy rights such as those provided by the California Consumer Privacy Act (CCPA) or the EU’s General Data Protection Regulation (GDPR). While GPC is a proposal, support has been implemented in Firefox and several other privacy-focused browsers and extensions. The GPC C specification is deliberately simple to implement with only a few moving pieces. Everything is covered in the implementation guide and demo site. In this post, we’ll look at implementing GPC within a Django project with code samples you can adapt. Because GPC is simple but requires very situation-dependent actions, it would be hard to build any specific support into Django or a third-party package. The GPC signal (sec-gpc header) When enabled, the browser sends a sec-gpc header with a value of 1, known as the GPC signal. It’s up to your site to save that the signal was seen for the user and act accordingly, depending on applicable regulations. You can check the header in a Django view like so: def index(request): ... gpc_enabled = request.headers.get("sec-gpc", "") == … -
Know your Python container types
This is the last of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Python contains multitudes There are a lot of container types available in the Python standard library, and it can be confusing sometimes to keep track of them all. So since it’s … Read full entry -
Compare strings the right way
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Unicode’s unique complexity It is the year 2023 — almost 2024! — and hopefully you’re using a programming language that is fully Unicode-aware. Python is; its string type is a sequence of … Read full entry -
Set cookies the right way
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Cookies in the cookie jar Django’s request and response objects, and their attributes and methods, make dealing with cookies easy. You can read from the request.COOKIES dictionary to get a cookie, and … Read full entry -
Django News - Understand Django - Dec 22nd 2023
News Python Developers Survey 2023 If you haven't already done so, we encourage you to complete the Python Developers Survey 2023 to share your thoughts. alchemer.com Tailwind CSS v3.4: Dynamic viewport units, :has() support, balanced headlines, subgrid, and more Tailwind CSS v3.4 was just released. This announcement highlights new features like dynamic viewport height units, parent-child styling with the :has() pseudo-class and * variant, text wrapping utilities, subgrid support, and extensions to existing utility scales. tailwindcss.com Django Software Foundation DSF Board monthly meeting, December 14, 2023 DSF Board monthly meeting minutes from the December 14, 2023 meeting. djangoproject.com Updates to Django Last week we had 19 pull requests merged into Django by 11 different contributors - including 5 first time contributors! Congratulations to Viicos, Nanami, Emanuel Andrecut, Christian Clauss, and erosselli for having their first commits merged into Django - welcome on board! Here are the key updates from last week: From 5.1, QuerySet.order_by will support ordering by annotation transforms such as JSONObject keys and ArrayAgg indices (#34013). From 5.1, accessible names for screen readers have been added to the "Add" / "Change" buttons in the Django Admin (#34909). The accessibility team are now publishing their meeting notes on the … -
Don't use Python's property
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Attributing the problem Suppose you’re writing Java and you write a class with an attribute : public class MyClass { public int value; } And then later on you realize that value … Read full entry -
Don’t Start Pull Requests from Your Main Branch
When contributing to other users’ repositories, always start a new branch in your repository. -
Use Django's system checks
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Check it out While you can do very minimal Django setups, more typical use cases tend to involve a mix of applications — your own, some third-party, and some from django.contrib — … Read full entry -
Sign Up - Building SaaS #178
In this episode, we did some work on the sign up template. In the process, we added some base template styling, talked about branding, and considered the other elements that are required before we can turn on sign up for others. I also cover waffle as a feature flag tool. -
Sign Up - Building SaaS with Python and Django #178
In this episode, we did some work on the sign up template. In the process, we added some base template styling, talked about branding, and considered the other elements that are required before we can turn on sign up for others. I also cover waffle as a feature flag tool. -
Understand Django - Matt Layman
MattLayman.comIncluded Health Software Estimation: Demystifying the Dark Art Understand Django Book@MattLayman on YouTubeDjango Riffs podcast Django Chat #82: Telemedicine with Matt Layman Support the ShowLearnDjango.comButtonDjango News newsletter -
Managing Technical Debt
My playbook for managing technical debt. -
Show Python deprecation warnings
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Let this be a warning Python provides the ability to issue a warning as a step below raising an exception; warnings are issued by calling the warnings.warn() function, which at minimum … Read full entry -
Running async tests in Python
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. A-sync-ing feeling Async Python can be useful in the right situation, but one of the tricky things about it is that it requires a bit more effort to run than normal synchronous … Read full entry -
Don't use class methods on Django models
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Being methodical about Python Python classes support three basic types of methods: Instance methods, which are what you get by default when writing a def statement inside a class body. These are … Read full entry -
Say what you mean in a regex
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. An URL-y warning Suppose you’re writing a blog in Django, and you get to the point where you’re setting up the URLs for the entries. Django has two ways to write … Read full entry -
Python packaging: use the "src"
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. A lurking problem Imagine you write a Python library named, say, foo. And you diligently set up the configuration to package it for distribution (which is not that hard; you can … Read full entry -
Weeknotes (2023 week 50)
Weeknotes (2023 week 50)django-imagefield The path building scheme used by django-imagefield has proven problematic: It’s too likely that processed images will have the same path. I have changed the strategy used for generating paths to use more data from the source; it’s now possible (and recommended!) to set IMAGEFIELD_BIN_DEPTH to a value greater than 1; 2 or 3 should be sufficient. The default value is 1 which corresponds to the old default so that the change won’t be backwards incompatible. However, you’ll always get a deprecation warning if you don’t set a bigger value yourself. The default will probably change in the future. Advent of Code I have always felt a bit as an imposter because I do not have any formal CS education; not so much in the last few years but certainly earlier in my career. I have enjoyed participating in the Advent of Code 2022 a lot and I have definitely learned to know when to use and how to use a few algorithms I didn’t even know before. I’m again working through the puzzles in my own pace and have managed to solve almost all of them up to today this year. There still are some … -
Django News - 2023 Malcolm Tredinnick Memorial Prize Winner - Dec 15th 2023
News 2023 Malcolm Tredinnick Memorial Prize awarded to Djangonaut Space Djangonaut Space, run by organizers Dawn Wages, Rachell Calhoun, Sarah Abderemane, Sarah Boyce, and Tim Schilling, is a mentoring initiative dedicated to expanding contributions and diversifying contributors within the Django community. djangoproject.com Python Release Python 3.12.1 Python 3.12 is the newest major release of the Python programming language, and it contains many new features and optimizations. 3.12.1 is the latest maintenance release, containing more than 400 bugfixes, build improvements and documentation changes since 3.12.0. python.org Python Insider: Python 3.11.7 is now available Python 3.11.7 is the newest major release of the Python programming language, and it contains many new features and optimizations. blogspot.com The State of Developer Ecosystem in 2023 Infographic This report is the culmination of insights gathered from 26,348 developers from all around the globe. jetbrains.com Python Software Foundation: "🐍📣 We have extended the Python…" - Fosstodon The Python Developers Survey for 2023 has been extended. Please help the PSF accurately represent the Python community by taking the survey, sharing this post, and sending to your local networks #python https://survey.alchemer.com/s3/7554174/python-developers-survey-2023 fosstodon.org 2FA Requirement for PyPI begins 2024-01-01 PyPI will require 2FA for all users on Jan 1, 2024. … -
Database functions in Django
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Functionally a database On top of the basic query syntax we’re all used to, SQL databases tend to have a large number of built-in functions — some of which are standardized, some … Read full entry -
Database views in Django
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. A view to a database Most databases support creating and working with views, which, if you’ve never encountered them before, are like a virtual table — instead of being defined by … Read full entry