Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
GeoDjango - Harout Boujakjian and Andrew Hornstra
pinplanet - a free app to pin where you’ve beenGeoDjango docs Python Data Science Handbook KotlinKtor django-imagefield ### Support the Show* [LearnDjango.com](http://learndjango.com)* [Button](https://btn.dev/)* [Django News newsletter](https://django-news.com) -
Weeknotes (2024 week 07)
Weeknotes (2024 week 07)This is a short weeknotes entry which mainly contains a large list of releases. The reason for the large list is that I haven’t published a weeknotes entry in weeks. Releases form-designer 0.23: Only small changes, mainly updated the package for current Django and Python versions. feincms3-cookiecontrol 1.4.6: A minor change: Swallow exceptions which happen during startup when clobbering the scripts data fails. As an aside: I find it funny that I have discovered the .f3cc class in some cookie banner blocklists. It feels good to be recognized even if this maybe isn’t the nicest way, but it works for me since I actually do not like cookie banners either. At least feincms3-cookiecontrol doesn’t inject anything without users’ consent, and doesn’t require a third party service to run. django-simple-redirects 2.2.0: Minor release which adds a search field to the admin changelist. django-simple-redirects is a repackaged version of django.contrib.redirects without the django.contrib.sites dependency. speckenv 6.2: django_cache_url now supports parsing redis configuration for a leader-replica redis installation with a read-write leader host and read-only replica hosts. I use the same configuration format as django-cache-url does. django-debug-toolbar 4.3: I haven’t done much here, just some reviewing here and there. I … -
Django News - 10 Years of Wagtail - Feb 16th 2024
News Python 3.13.0 alpha 4 is now available Python 3.13 is still in development. This release, 3.13.0a4, is the fourth of six planned alpha releases. blogspot.com django-ckeditor Some notes about CKEditor 4 and how they impact the django-ckeditor package. 406.ch Django Software Foundation Django accessibility in 2023 and beyond The Django accessibility team has been up and running for three years and is now looking for new members. djangoproject.com Updates to Django Today 'Updates to Django' is presented by Raffaella Suardini from Djangonaut Space! Last week we had 18 pull requests merged into Django by 14 different contributors - including 5 first time contributors! Congratulations to Koo, bcail, shivaramkumar, Vašek Dohnal, and danigm for having their first commits merged into Django - welcome on board! Exciting news in Django 5.1: ModelAdmin.list_display now supports using __ lookups to list fields from related models. django.utils.text.Truncator used on truncatechars_html and on truncatewords_html template filter now uses html.parser.HTMLParser subclasses. This results in a more robust and faster operation Not enough? There's valuable news in 5.0: Fixed a regression in Django 5.0.2 where the intcomma template filter could return a leading comma for string representation of floats. CTA for someone with UX/UI experience: There's an … -
Django User Model talk at Django Boston Meetup
A link to the slides and thoughts on improvements for next team on this topic. -
Paying people to work on open source is good actually
If you have a problem with maintainers getting paid then you have a problem with me and I suggest you let that one marinate. -
Algorithmic Art with Python
In this talk, we’re going to start from nothing and build out our own tools for making art in Python, no AI needed! We’ll show how Python’s expressiveness allows us to describe graphics elegantly and use that to make some unique art programmatically. -
Algorithmic Art with Python
NOTE: The audio is a bit low. I did my best to boost the volume. Sorry for not dialing this in better during recording -
django-ckeditor
django-ckeditor It has finally happened. The open source version of CKEditor 4 does not contain fixes for known problems, see the CKEditor 4.24.0 LTS announcement. I totally get why the CKEditor developers did this and can only thank them for all the work that went into the editor. I wish I didn’t have to do the migration work to move basically everything to a different editor. The CKEditor 4 LTS version is only expected to be supported until the end of 2026 and I have a few projects which will be around far longer than this (or at least I hope so). Therefore, buying the LTS package would only delay the inevitable. CKEditor 5 is a completely different editor and uses the GPL license, so that’s not really an option either. TinyMCE is well known and I have been using it much earlier in my career, but reimplementing plugins isn’t fun to do. I would prefer moving everything to ProseMirror or some other structured editor, but we have so much legacy content contained in HTML blobs which do not use any schema at all that this isn’t workable unfortunately. Stay tuned for updates – they will come since I unfortunately … -
How to avoid a count query in Django if you can
Suppose you have a complex Django QuerySet query that is somewhat costly (in other words slow). And suppose you want to return: The first N results A count of the total possible results So your implementation might be something like this: def get_results(queryset, fields, size): count = queryset.count() results = [] for record in queryset.values(*fields)[:size] results.append(record) return {"count": count, "results": results} That'll work. If there are 1,234 rows in your database table that match those specific filters, what you might get back from this is: >>> results = get_results(my_queryset, ("name", "age"), 5) >>> results["count"] 1234 >>> len(results["results"]) 5 Or, if the filters would only match 3 rows in your database table: >>> results = get_results(my_queryset, ("name", "age"), 5) >>> results["count"] 3 >>> len(results["results"]) 3 Between your Python application and your database you'll see: query 1: SELECT COUNT(*) FROM my_database WHERE ... query 2: SELECT name, age FROM my_database WHERE ... LIMIT 5 The problem with this is that, in the latter case, you had to send two database queries when all you needed was one. If you knew it would only match a tiny amount of records, you could do this: def get_results(queryset, fields, size): - count = queryset.count() results … -
How to avoid a count query in Django if you can
Suppose you have a complex Django QuerySet query that is somewhat costly (in other words slow). And suppose you want to return: The first N results A count of the total possible results So your implementation might be something like this: def get_results(queryset, fields, size): count = queryset.count() results = [] for record in queryset.values(*fields)[:size] results.append(record) return {"count": count, "results": results} That'll work. If there are 1,234 rows in your database table that match those specific filters, what you might get back from this is: >>> results = get_results(my_queryset, ("name", "age"), 5) >>> results["count"] 1234 >>> len(results["results"]) 5 Or, if the filters would only match 3 rows in your database table: >>> results = get_results(my_queryset, ("name", "age"), 5) >>> results["count"] 3 >>> len(results["results"]) 3 Between your Python application and your database you'll see: query 1: SELECT COUNT(*) FROM my_database WHERE ... query 2: SELECT name, age FROM my_database WHERE ... LIMIT 5 The problem with this is that, in the latter case, you had to send two database queries when all you needed was one. If you knew it would only match a tiny amount of records, you could do this: def get_results(queryset, fields, size): - count = queryset.count() results … -
Django: Join the community on Mastodon
Mastodon is a Twitter-like social network with a solid Django community presence. It’s a fantastic online arena for connecting with others, discovering news, discussing issues, and sharing FOMO-inducing conference photos. Historically, Twitter was the primary social network for the Django community, as for much of tech. But since Elon Musk took Twitter over in 2022, it has steadily degraded, technically and ethically. This enshittification has led most active Django Twitter people to migrate to Mastodon, a decentralized, open alternative. Some have done a hard cut, others have maintained accounts on both. I’ve used Mastodon since November 2022 and have enjoyed using it since. I still log in to Twitter to interact with people who are exclusively there, but I hope they will migrate to Mastodon soon. This post covers the best resources I know of to join the Django community on Mastodon. I hope this convinces you to try Mastodon, whether or not you used Twitter. Selflessly, I believe connecting with others and sharing ideas makes you a better developer. Selfishly, I want more interesting Django posts in my feed! Sign up on a server Mastodon is federated across many independent servers. You pick one to host your account but … -
Django News - Django security releases issued: 5.0.2, 4.2.10, and 3.2.24 - Feb 9th 2024
News Django security releases issued: 5.0.2, 4.2.10, and 3.2.24 This security release addresses a potential denial-of-service in intcomma template filter. As always, one of the best security measures is to always update your Django project's to the latest release. djangoproject.com Neapolitan 24.2 release Quicker template overrides and minimal tests in the latest update. noumenal.es Updates to Django Today 'Updates to Django' is brought to you by Velda Kiara from Djangonaut Space! Last week we had 22 pull requests merged into Django by 16 different contributors - including 5 first time contributors! Congratulations to Petar Netev, Candide U, Priya, Anže Pečar, and James Thorniley for having their first commits merged into Django - welcome on board! Last week we saw some compelling updates to Django 5.0: Backward incompatibility note note about filtering against overflowing integers was added. FilteredRelation now raises a ValueError when a queryset is provided as the right-hand side, this change aims to enhance structure and predictability. Updates on GeoDjango include additional support for measured geometrics to GDAL Polygons and GDAL LineString. Djangosites was shut down on the 23rd of January. Inspite of the shut down there is a new site built with django serving the same purpose. Django … -
Stripe Checkout - Building SaaS #182
In this episode, we did work to get the Stripe checkout session going. We set up Stripe Product and Price objects to get the subscription plan ready and got the Stripe checkout session working mostly end-to-end -
Stripe Checkout - Building SaaS with Python and Django #182
In this episode, we did work to get the Stripe checkout session going. We set up Stripe Product and Price objects to get the subscription plan ready and got the Stripe checkout session working mostly end-to-end -
Tracking Engineering Time
How do you understand what engineers are doing with that time? How do you know if they’re working on the “right” things? Here’s how I suggest answering those questions. -
Django REST Framework and Vue versus Django and HTMX
This article compares the development experience with Vue and Django REST Framework against HTMX and Django. -
Renewing Let's Encrypt Certificates with NGINX Unit
Recently, I moved the DjangoTricks website and started PyBazaar on servers with Nginx Unit. One thing that was left undone was SSL certificate renewals. Let's Encrypt has special certbot parameters for renewing certificates for websites on Apache or Nginx servers, but they don't work out of the box with the Nginx Unit. In this blog post, I will tell you how to do that. The certificate bundle Nginx Unit doesn't use the fullchain.pem and privkey.pem generated by certbot directly from the location where they were generated. Instead, one has to create a bundle (like bundle1.pem) by concatenating them and then uploading it to the Nginx Unit configuration endpoint. The bash script For that, I created a bash script: #!/usr/bin/env bash SECONDS=0 CRON_LOG_FILE=/var/webapps/pybazaar/logs/renew_certificate.log echo "=== Renewing Letsencrypt Certificate ===" > ${CRON_LOG_FILE} date >> ${CRON_LOG_FILE} echo "Renewing certificate..." >> ${CRON_LOG_FILE} certbot --renew-by-default certonly -n --webroot -w /var/www/letsencrypt/ -m hello@pybazaar.com --agree-tos --no-verify-ssl -d pybazaar.com -d www.pybazaar.com echo "Creating bundle..." >> ${CRON_LOG_FILE} cat /etc/letsencrypt/live/pybazaar.com/fullchain.pem /etc/letsencrypt/live/pybazaar.com/privkey.pem > /var/webapps/pybazaar/unit-config/bundle1.pem echo "Temporarily switching the Unit configuration to a dummy one..." >> ${CRON_LOG_FILE} curl -X PUT --data-binary @/var/webapps/pybazaar/unit-config/unit-config-pre.json --unix-socket /var/run/control.unit.sock http://localhost/config echo "Deleting old certificate from Nginx Unit..." >> ${CRON_LOG_FILE} curl -X DELETE --unix-socket /var/run/control.unit.sock http://localhost/certificates/certbot1 echo "Installing … -
Django News - htmx 2.x Migration Guide - Feb 2nd 2024
News PSF News: Kicking off 2024 strong, thanks to our community! The PSF is starting the year feeling energized and supported, thanks to each of you who shared or donated to the year-end fundraiser and membership drive. blogspot.com </> htmx ~ htmx 1.x → htmx 2.x Migration Guide The purpose of this guide is to provide instructions for migrations from htmx 1.x to htmx 2.x. We place a very high value on backwards compatibility, so in most cases this migrations should require very little, if any, work. htmx.org Updates to Django Today 'Updates to Django' is brought to you by Pradhvan Bisht and Mohammad Alsakhawy from Djangonaut Space! The Django roadmap is here! Meeting modern auth standards, switching to Jinia2, built-in API framework, built-in rate limiting, sponsored Django features, making Django-Update official, and many more exciting ideas made it into the roadmap! And the discussion is still ongoing. Last week we had 15 pull requests merged into Django by 11 different contributors - including 3 first time contributors! Congratulations to Marijke Luttekes, Adrienne Franke, and Aryan Gholizadeh Mojaveri for having their first commits merged into Django - welcome on board! We're still seeing more updates to GeoDjango: OGRGeometry.coord_dim is deprecated … -
Django Hello, World
## Table of Contents - [Create a Virtual Environment](#create-a-virtual-environment) - [Install Django](#install-django) - [Create a Django Project](#create-a-django-project) - [Add Hello, World](#create-a-django-app) - [Next Steps](#next-steps) [Django](https://www.djangoproject.com/) is a high-level Python web … -
20 Django Packages That I Use in Every Project
Django is a "batteries-included" web framework that provides most of your needs to build complex web applications. But its real strength lies in the larger Django ecosystem of third-party packages … -
How to Create Virtual Environments in Python
## Table of Contents - [What is a Virtual Environment?](#what-is-a-virtual-environment) - [Create a Virtual Environment](#create-a-virtual-environment) - [Activate a Virtual Environment](#activate-a-virtual-environment) - [Install Packages](#install-packages) - [Deactivate the Virtual Environment](#deactivate-the-virtual-environment) Virtual environments … -
Safely rewriting complex code
There is a lot of advice out there suggesting to never rewrite anything. Just improve it in small increments. This is sound advice for services, modules or large chunks of code. Yet sometimes rewriting a complex part of your system will be inevitable. This does not mean the above advice does not apply. You still want to minimise risk and potentially try to ship smaller increments instead of rewriting 2000 lines of code in one go. No matter how big you deside to make the change, some guardrails and a safety net will come in handy. For basically any Python project one of the first developer dependencies I install is pytest. For Django projects I always add pytest-django. For feature flags my preferred library is Django Waffle. The code examples show how to use these three libraries to make a rewrite less scary. But there is no functionality exclusive to these three libs. You can easily replicate the approach with alternatives or in other languages and frameworks. The complete code and Django project can be found here. Starting simple One of the features I really appreciate is parameterize. You can add a list of values which is passed to your … -
Django News - Apply to be the next Django Fellow! - Jan 26th 2024
News Announcing: The Outstanding PyLady Award Do you know of a PyLady that should be recognized for all their work for Python and the community? Nominate them (or yourself)! pyladies.com Django Software Foundation DSF calls for applicants for a Django Fellow After five years as part of the Django Fellowship program, Mariusz Felisiak will step down as a Django Fellow in March 2024 to explore other things. Mariusz has made an extraordinary impact as a Django Fellow and has been a critical part of the Django community. Applications will be open until 1200 AoE, February 16, 2024, with the expectation that the successful candidate will be notified no later than March 1, 2024. djangoproject.com Updates to Django Today 'Updates to Django' is brought to you by Mohammad Alsakhawy from Djangonaut Space! Last week we had 16 pull requests merged into Django by 14 different contributors - including 3 first time contributors! Congratulations to Aivars Kalvāns, Alexis A., and Emmanuel Katchy for having their first commits merged into Django - welcome on board! Last week saw some exciting developments in 5.1: Model.refresh_from_db() and Model.arefresh_from_db() has a new parameter from_queryset that gives you more control over how the model is reloaded. makemigrations … -
When PyCharm Deletes Poetry Virtual Environments: The Fix
I use PyCharm as my Python IDE and Poetry for dependency and virtual environment management. However, the magnificent combination of these tools occasionally encounters a weird issue: PyCharm deletes the Poetry virtual environment when you launch the IDE. Though the problem occurs infrequently, when it does, it leads to a … Read now -
Payments Gateway - Building SaaS #181
In this episode, we continued on the Stripe integration. I worked on a new payments gateway interface to access the Stripe APIs needed for creating a check out session. We hit some bumps along the way because of djstripe’s new preference for putting the Stripe keys into the database exclusively.