Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
No Frills, Just Go: Standard Library Only Web Apps
How much can you build in Go with zero extra packages? What is possible using nothing more than Go’s standard library? In this talk, you’re going to find out! -
Weeknotes (2024 week 35)
Weeknotes (2024 week 35) Getting deep into htmx and django-template-partials I have been skeptical about htmx for some time because basically everything the library does is straightforward to do myself with a few lines of JavaScript. I am a convert now because, really, adding a few HTML attributes is nicer than copy pasting a few lines of JavaScript. Feels good. The combination of htmx with django-template-partials is great as well. I didn’t know I had been missing template partials until I started using them. Includes are still useful, but replacing some of them with partials makes working on the project much more enjoyable. I haven’t yet had a use for django-htmx but I may yet surprise myself. Releases django-authlib 0.17: django-authlib bundles authlib.little_auth which offers an user model which uses the email address as the username. I have also introduced the concept of roles instead of permissions; now I have reorganized the user admin fieldset to hide user permissions altogether. Group permissions are still available as are roles. I’m personally convinced that user permissions were a mistake. feincms3-forms 0.5: Allowed setting a maximum length for the bundled URL and email fields through the Django administration interface. django-content-editor 7.0.7: Fixed a … -
Production-ready Python Docker Containers with uv
Starting with 0.3.0, Astral’s uv brought many great features, including support for cross-platform lock files uv.lock. Together with subsequent fixes, it has become Python’s finest workflow tool for my (non-scientific) use cases. Here’s how I build production-ready containers, as fast as possible. -
There can't be only one
There’s a concept that I’ve heard called by a lot of different names, but my favorite name for it is “the Highlander problem”, which refers to the catchphrase of the campy-yet-still-quite-fun Highlander movie/TV franchise. In Highlander, immortal beings secretly live amongst us and sword-fight each other in hopes of being the last one standing, who will then get to rule the world forever. And when one of them is about to eliminate another, … Read full entry -
KISS Beats Accidental Complexity
Our friends at Sanvira published a blog post about a Django project they shipped five years ago, which is still running today without change, hand holding or application server restart. I really enjoy stories like this. Small, well engineered monoliths, just sitting there doing their job and not randomly breaking. While this sounds trivial it is not – and it is by far not the standard. I have seen enough systems fall apart for random reasons. Missing database indexes being on top of the list. The other thing that stands out to me are the frameworks and libraries. You can start nearly any web project with the exact same components today. (Ignoring VueJS - I reserve the right to not have an opinion on technologies and in domains I am not involved in.) APIs might have changed a bit. Functionality was added and bugs have been fixed. But they are all still around, doing well and have proven to be production ready. Compare that to ecosystems which reinvent package management every other week. -
Django Tailwind
This tutorial demonstrates how to configure Django and TailwindCSS from scratch in a new project. ## Django Setup Create a new virtual environment called `.venv`. ``` # Windows … -
Django News - Wagtail 6.2.1 release - Aug 23rd 2024
News PyPI Slashes Malware Response Time: 90% of Issues Resolved in Under 24 Hours PyPI has drastically improved its malware response times, resolving 90% of issues in under 24 hours and removing 900 projects since March 2024. socket.dev Updates to Django Today 'Updates to Django' is presented by Lilian from Djangonaut Space! Last week we had 12 pull requests merged into Django by 9 different contributors - including 2 first-time contributors! Congratulations to Marc Picaud and Mohammad Salehi for having their first commits merged into Django - welcome on board! News in Django 5.2: Added support for validation of model constraints which use a GeneratedField. The new Expression.set_returning attribute specifies that the expression contains a set-returning function, enforcing subquery evaluation. This is necessary for many Postgres set-returning functions. Django Newsletter Wagtail CMS Wagtail 6.2.1 release notes Four new bugfixes in the latest release. wagtail.org Sponsored Link 1 Free Trial of Scout APM Today! Need answers to your Django app questions fast? Avoid the hassle of talking with a sales rep and the long wait times of large support teams, and choose Scout APM. Get Django insights in less than 4 minutes with Scout APM. scoutapm.com Articles Django UserProfile Model How … -
Golang Middleware and DBs - Building SaaS #199
In this episode, we continued the break from JourneyInbox to look through more of the Go standard library. In this session, we talked about middleware, request context, and using databases. -
Golang Middleware and DBs - Building SaaS #199
In this episode, we continued the break from JourneyInbox to look through more of the Go standard library. In this session, we talked about middleware, request context, and using databases. -
Django UserProfile Model
Every website needs a way to handle user authentication and logic about users. Django comes with a built-in [User model](https://docs.djangoproject.com/en/5.1/ref/contrib/auth/#user-model) as well as views and URLs for login, log out, … -
Custom Error Messages on Model Deletion in the Django Admin
I have been working on a project where we might want to delete models even just for testing purposes, but we don't want to accidentally delete models. Protect Model Deletion Let's say you have a Django model: from django.db import models class User(models.Model): name = models.CharField(max_length=255) email = models.EmailField() class Rental(models.Model): name = models.CharField(max_length=255) current_renter = models.ForeignKey( User, on_delete=models.CASCADE, null=True, blank=True ) At some point, I might sell and delete my Rental object, but I don't want to do that if I have someone renting it at the moment. Override Model delete() Method We can put in our own custom logic to prevent this deletion if there's an active renter: from django.core.exceptions import ValidationError # new class Rental(models.Model): # ... def delete(self, *args, **kwargs): # Check if someone is renting at the moment if self.user_set.exists(): raise ValidationError( f"Cannot delete rental {self.name} while someone is in it." ) # If no renter, proceed with deletion super().delete(*args, **kwargs) Message the User by Overriding the delete_model() Method In our Model's Admin class, we can override the delete_model() method to give the user feedback as to why we stopped their deletion so they aren't left totally confused: from django.contrib import admin from django.contrib import … -
How I handle versioning
How I handle versioning I have been reading up on versioning methods a bit, and I noticed that I never shared my a bit unorthodox versioning method. I previously wrote about my rules for releasing open source software but skipped everything related to versioning. I use something close to the ideas of semantic versioning but it’s not quite that. Note that the versioning scheme has nothing to do with production readiness, it’s more about communicating the state of the project. 0.0.x – Everything breaks I don’t trust my choices a lot. Everything may radically change, and I may also abandon the project with no hard feelings. 0.1.0 – Changelogging I generally start writing release notes or rather a Changelog, since writing full release notes is much more work. You absolutely have to test the software and I do not guarantee anything related to backwards compatibility – just that you’ll know about breaking changes when you read the CHANGELOG. ?.?.x – Bugfixes and pure additions Strictly speaking, patch version increments are only for bugfixes. However, when I add new features which are purely additional to the package or if there’s no way (famous last words) that anything will break, I’ll upload … -
Limiting Content Types in a Django Model
This article looks at how to limit the content types in a Django model. -
Django News - Django 5.2 News - Aug 16th 2024
News PSF Community Service Awards to Kojo Idrissa! 🎉 Congratulations to Kojo Idrissa on his well-deserved Community Service Award. This award was given to Kojo for delivering insightful talks, organizing events like DjangoCon US, and engaging in discussions with developers and new Python developers. Kojo consistently champions the growth and inclusivity of the Python ecosystem. python.org Announcing PSF Fellow Members for Q1 2024! 🎉 Congratulations to Adam Johnson and Paolo Melchiorre on becoming PSF Fellows for 2024. blogspot.com DjangoCon US Keynotes: Natalia Bidart Django Fellow, Natalia Bidart, is keynoting DjangoCon US 2024 this fall. In-person and online tickets are available. djangocon.us VSCode Pre-Release of Running Tests Django tests are now supported in the VS Code Python extension! This is currently a pre-release, so we appreciate any users who can try it out and provide feedback or submit bugs. github.com Django Software Foundation DSF Board monthly meeting, August 8, 2024 Meeting minutes for DSF Board monthly meeting, August 8, 2024 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 12 different contributors - including 2 first-time contributors! Congratulations to Jure Cuhalev and Farhan … -
More Go Standard Library - Building SaaS #198
In this episode, we continued the break from JourneyInbox to look through more of the Go standard library. In this session, we explored JSON serialization, Go template support, and embedding of static files for easy access. -
More Go Standard Library - Building SaaS #198
In this episode, we continued the break from JourneyInbox to look through more of the Go standard library. In this session, we explored JSON serialization, Go template support, and embedding of static files for easy access. -
PDF Text Extraction With Python
Is your data locked up in portable document format (PDFs)? In this talk we’re going to explore methods to extract text and other data from PDFs using readily-available, open-source Python tools (such as pypdf), as well as techniques such as OCR (optical character recognition) and table extraction. We will also discuss the philosophy of text extraction as a whole. -
PDF Text Extraction With Python
Is your data locked up in portable document format (PDFs)? In this talk we’re going to explore methods to extract text and other data from PDFs using readily-available, open-source Python tools (such as pypdf), as well as techniques such as OCR (optical character recognition) and table extraction. We will also discuss the philosophy of text extraction as a whole. -
Weeknotes (2024 week 33)
Weeknotes (2024 week 33) Partying It’s summer, it’s hot, and it’s dance week. Lethargy is over, Jungle Street Groove is coming up. Good times. Releases django-json-schema-editor 0.1: I have finally left the alpha versioning. I’m still not committing to backwards compatibility, but I have started writing a CHANGELOG. django-prose-editor 0.7.1: Thanks to Carlton’s pull request I have finally cleaned up the CSS somewhat and made overriding the styles more agreeable when using the editor outside the Django administration. The confusing active state of menubar buttons has also been rectified. Docs are now available on Read the Docs. django-imagefield 0.19: django-imagefield can now be used with proxy models. Previously, thumbnails weren’t generated or deleted when saving proxy models because the signal handlers would only be called if the sender matches exactly. I have already debugged this before, but have forgotten about it again. The ticket is really old for this, and fixing it isn’t easy since it’s unclear what should happen (#9318). django-canonical-domain 0.11: django-canonical-domain has gained support for excluding additional domains from the canonical domain redirect. django-canonical-domain is used to redirect users to HTTPS (optionally) and to a particular canonical domain (as the name says). But sometimes you have auxiliary … -
Django: create sub-commands within a management command
argparse, the standard library module that Django uses for parsing command line options, supports sub-commands. These are pretty neat for providing an expansive API without hundreds of individual commands. Here’s an example of using sub-commands in a Django management command: from django.core.management.base import BaseCommand class Command(BaseCommand): def add_arguments(self, parser): subparsers = parser.add_subparsers( title="sub-commands", required=True, ) recharge_parser = subparsers.add_parser( "recharge", help="Recharge the laser.", ) recharge_parser.set_defaults(method=self.recharge) shine_parser = subparsers.add_parser( "shine", help="Shine the laser.", ) shine_parser.add_argument( "--bright", action="store_true", help="Make it lighter." ) shine_parser.set_defaults(method=self.shine) def handle(self, *args, method, **options): method(*args, **options) def recharge(self, *args, **options): self.stdout.write("Recharging the laser...") def shine(self, *args, bright, **options): if bright: self.stdout.write("✨✨✨ Shine ✨✨✨") else: self.stdout.write("✨ Shine ✨") The add_arguments() method sets up two sub-parsers for different sub-commands: recharge and shine. They use a pattern recommended by the argparse add_subparsers() documentation, storing a function to call for the parser with set_defaults(). The second sub-parser for shine takes an optional --bright argument as well. The parser.add_subparsers() call sets required=True, which makes argparse show the command help and exit if no sub-command is provided. This means handle() is only called when a sub-command is selected, so its function signature can directly reference the method keyword argument. handle() only route to the correct … -
Django News - ✨ Django 5.1 is out! - Aug 9th 2024
News Django 5.1 released Django 5.1 was released, featuring the new LoginRequiredMiddleware for easier authentication and several accessibility enhancements, including improved screen reader support and more semantic HTML elements. There is also a querystring template tag simplifies query string handling in templates. djangoproject.com Django security releases issued: 5.0.8 and 4.2.15 The Django team has issued security releases 5.0.8 and 4.2.15, addressing multiple vulnerabilities, including potential memory exhaustion, denial-of-service attacks, and SQL injection risks; users are advised to upgrade immediately. djangoproject.com Python 3.12.5 released Python 3.12.5 is the latest maintenance release, containing more than 250 bug fixes, build improvements, and documentation changes since 3.12.4. blogspot.com PSF News: Security Developer-in-Residence role extended thanks to Alpha-Omega Thanks to continued support from Alpha-Omega, Seth Larson's role as Security Developer-in-Residence has been extended through the end of 2024, focusing on enhancing Python ecosystem security. blogspot.com Updates to Django Today 'Updates to Django' is presented by Raffaella Suardini from Djangonaut Space! Last week we had 14 pull requests merged into Django by 10 different contributors - including 2 first-time contributors! Congratulations to Jeremy Thompson and Lucas Esposito for having their first commits merged into Django - welcome on board! Django 5.2 is introducing new form widgets: … -
Go Standard Library App - Building SaaS #197
In this episode, we are taking a break from JourneyInbox and exploring what kind of Go app we can make by just using the Go standard library. -
Go Standard Library App - Building SaaS #197
In this episode, we are taking a break from JourneyInbox and exploring what kind of Go app we can make by just using the Go standard library. -
An Opinionated Introduction to CI/CD
Continuous Integration / Continuous Delivery (or Deployment), CI/CD, is a set of practices used by engineering organizations to improve the quality of software they deliver, how fast they deliver that software, and detect issues with that software before they affect end users. Unfortunately, the term can mean a lot of different ideas and approaches. So, in this talk we’re going to try to unravel some of those ideas to give you some ideas on how you too can deliver software better. -
An Opinionated Introduction to CI/CD
Continuous Integration / Continuous Delivery (or Deployment), CI/CD, is a set of practices used by engineering organizations to improve the quality of software they deliver, how fast they deliver that software, and detect issues with that software before they affect end users. Unfortunately, the term can mean a lot of different ideas and approaches. So, in this talk we’re going to try to unravel some of those ideas to give you some ideas on how you too can deliver software better.