| web | http://simonwillison.net/ |
|---|---|
| Author |
Sept. 29, 2024 » Simon Willison's Weblog: django » [Archived Version]
Ensuring a block is overridden in a Django template Neat Django trick by Tom Carrick: implement a Django template tag that raises a custom exception, then you can use this pattern in your templates: {% block title %}{% ensure_overridden %}{% endblock %} To ensure you don't accidentally extend a base template but forget to fill out a critical block. Via Carlton Gibson Tags: django, python
Read MoreSept. 28, 2024 » Simon Willison's Weblog: django » [Archived Version]
DjangoTV Brand new site by Jeff Triplett gathering together videos from Django conferences around the world. Here's Jeff's blog post introducing the project. Via @webology Tags: jeff-triplett, django
Read MoreSept. 27, 2024 » Simon Willison's Weblog: django » [Archived Version]
I just arrived home from a trip to Durham, North Carolina for DjangoCon US 2024. I’ve already written about my talk where I announced a new plugin system for Django; here are my notes on some of the other themes that resonated with me during the conference. Growing the Django Software Foundation (DSF) Could we fund a Django LTS accessibility audit? Django fellows continue to provide outstanding value Django needs feature champions htmx fits Django really well Django Ninja has posi…
Read MoreSept. 26, 2024 » Simon Willison's Weblog: django » [Archived Version]
django-plugin-datasette I did some more work on my DJP plugin mechanism for Django at the DjangoCon US sprints today. I added a new plugin hook, asgi_wrapper(), released in DJP 0.3 and inspired by the similar hook in Datasette. The hook only works for Django apps that are served using ASGI. It allows plugins to add their own wrapping ASGI middleware around the Django app itself, which means they can do things like attach entirely separate ASGI-compatible applications outside of the regular Djan…
Read MoreSept. 25, 2024 » Simon Willison's Weblog: django » [Archived Version]
DJP is a new plugin mechanism for Django, built on top of Pluggy. I announced the first version of DJP during my talk yesterday at DjangoCon US 2024, How to design and implement extensible software with plugins. I'll post a full write-up of that talk once the video becomes available - this post describes DJP and how to use what I've built so far. Why plugins? Setting up DJP django-plugin-django-header django-plugin-blog django-plugin-database-url Writing a plugin W…
Read MoreSept. 24, 2024 » Simon Willison's Weblog: django » [Archived Version]
nanodjango Richard Terry demonstrated this in a lightning talk at DjangoCon US today. It's the latest in a long line of attempts to get Django to work with a single file (I had a go at this problem 15 years ago with djng) but this one is really compelling. I tried nanodjango out just now and it works exactly as advertised. First install it like this: pip install nanodjango Create a counter.py file: from django.db import models from nanodjango import Django app = Django() @app.admin # Registe…
Read MoreSept. 15, 2024 » Simon Willison's Weblog: django » [Archived Version]
UV — I am (somewhat) sold Oliver Andrich's detailed notes on adopting uv. Oliver has some pretty specific requirements: I need to have various Python versions installed locally to test my work and my personal projects. Ranging from Python 3.8 to 3.13. [...] I also require decent dependency management in my projects that goes beyond manually editing a pyproject.toml file. Likewise, I am way too accustomed to poetry add .... And I run a number of Python-based tools --- djhtml, poetry, ipython, l…
Read MoreAug. 13, 2024 » Simon Willison's Weblog: django » [Archived Version]
New Django {% querystring %} template tag Django 5.1 came out last week and includes a neat new template tag which solves a problem I've faced a bunch of times in the past. {% querystring color="red" size="S" %} Adds ?color=red&size=S to the current URL - keeping any other existing parameters and replacing the current value for color or size if it's already set. {% querystring color=None %} Removes the ?color= parameter if it is currently set. If the value passed is a list it will append ?col…
Read MoreAug. 8, 2024 » Simon Willison's Weblog: django » [Archived Version]
Yesterday I finally developed something I’ve been casually thinking about building for a long time: django-http-debug. It’s a reusable Django app - something you can pip install into any Django project - which provides tools for quickly setting up a URL that returns a canned HTTP response and logs the full details of any incoming request to a database table. This is ideal for any time you want to start developing against some external API that sends traffic to your own site - a webhooks provide…
Read MoreJuly 17, 2024 » Simon Willison's Weblog: django » [Archived Version]
Announcing our DjangoCon US 2024 Talks! I'm speaking at DjangoCon in Durham, NC in September. My accepted talk title was How to design and implement extensible software with plugins. Here's my abstract: Plugins offer a powerful way to extend software packages. Tools that support a plugin architecture include WordPress, Jupyter, VS Code and pytest - each of which benefits from an enormous array of plugins adding all kinds of new features and expanded capabilities. Adding plugin support to an op…
Read More