#Django5

pvergain (framapiaf)pvergain@framapiaf.org
2025-04-08

- adamj.eu/tech/2025/04/07/djang

The new How to customize the shell command (docs.djangoproject.com/en/5.2/) documentation page covers adding extra automatic imports by defining a custom shell command override.

Here’s an example that goes beyond the docs:

Thanks @adamchainz 🙏🏻

#python #webdev #django #Django5.2 #djangonews

from django.core.management.commands import shell
from django.db.models import __all__ as models_all

import polars as pl  # noqa: F401


class Command(shell.Command):
    def get_auto_imports(self):
        return [
            *super().get_auto_imports(),
            "sys",
            "os",
            "pathlib.Path",
            "django.conf.settings",
            "django.urls.reverse",
            "django.urls.resolve",
            # Everything from django.db.models
            *[f"django.db.models.{name}" for name in models_all],
            # Polars with alias pl
            f"{__name__}.pl",
        ]

Note:

-  The super() call pulls in the default model import paths.
-  The first extra items pull in useful bits of Python’s standard library: sys, os, and pathlib.Path.
- The extra django.* strings add some useful functions: the settings object and the URL functions reverse() and resolve().
- The django.db.models list comprehension is equivalent to from django.db.models import *, pulling in many objects useful for ad-hoc queries like F(), Q(), and Avg(). (Hopefully, we can add support for import * in the future.)
- The polars import is a bit of a hack to support pulling in Polars with its typical alias pl, due to the limited nature of get_auto_imports() only supporting full import paths. (Hopefully, we can add alias support in the future.)
Nube Colectivanubecolectiva
2024-10-26

A Cheatsheet on Comparing API Architectural Styles !

Una hoja de referencia para comparar estilos arquitectónicos de API !

Aprende a "Como Crear Un CRUD con Django 5 – Parte 2:
👉 blog.nubecolectiva.com/como-cr


Paolo Melchiorrepaulox@fosstodon.org
2024-09-25

Sarah Boyce is giving the talk "Hidden gems of Django 5.x" at DjangoCon US 2024 in Durham, North Carolina (US) 🐂

2024.djangocon.us/talks/hidden

#Django #DjangoCon #DjangoConUS #DjangoConUS2024 #Django5 #Gems #Fellow #Accessibility

CC @sarahboyce @djangocon

Sarah on the stageSarah on the stageSarah on the stageSarah on the stage
Akshat Singhakshatsingh
2024-09-10

🚀 .1 has been out for a month! Key updates include Template Tag, connection pools, LoginRequiredMiddleware, and improved testing tools. Note: MariaDB 10.4 & PostgreSQL 12 are no longer supported.
See Blog: link.medium.com/3xVDv7mJMMb

Jeremy Garniauxjeremy@mapstodon.space
2023-12-14

It's a Django 5.0 kind of day: I'm diving straight into the heart of the matter with the new field group feature. It will allow me to consequently lighten my templates. Yay!

Django upgrade went smooth, everything is working fine. Had an issue with django-countries but it was quickly fixed (github.com/SmileyChris/django-).

#Django #Django5

Sebastian MuthwillSebastianM6L
2023-12-05

Ooh that was fast. has been yesterday released and today I already have the to bump Django for .

Unfortunately the pipeline fails so I have to investigate what breaks with the new version. Best case only some

Screenshot from a GitHub Dependabot PR to bump Django from 4.2.7 to 5.0
Paolo Melchiorrepaulox@fosstodon.org
2023-12-04

Django 5.0 has been released 🎉

After months of work, everyone can use this great new version 🙌

My favorite features are:
• 🤖 generated fields
• ✅ database default values
• 🔑 prefetch related for generic foreign keys

Which are your favorite features?
djangoproject.com/weblog/2023/

#Django #GeneratedField #GeneratedColumn #Database #ORM #SQLite #PostgreSQL #MySQL #MariaDB #Default #ForeignKey #Django5 #Python #Python312 #Web #Framework #Release #ORM

stfn :raspberrypi: :python:stfn@fosstodon.org
2023-12-04

OK, I went through the release notes I am loving the GeneratedField option and being able to set SQL-level defaults in the db. Both will be useful.

#Django5

Helen ScottHelenJoScott
2023-12-04

Do you want an overview of ? Well our newest Developer Advocate @sarahboyce has made this video just for you! youtu.be/lPl5Q5gv9G8

Oh, and the channel is new so don't forget to like & subscribe for more awesome content from Sarah!

2023-11-07

@paulox Thanks for sharing. I didn't even know that SQL has generated fields. Now i have a reason to look forward to #Django5.

Paolo Melchiorrepaulox@fosstodon.org
2023-09-27

I found my second bug in Django 5.0 after the feature freeze 🐛

It's related to GeneratedField and DecimalField and maybe you can help to fix it 👇
code.djangoproject.com/ticket/

#django #django5 #bug #generatedfield #decimalfield #sql #orm #migrations

Paolo Melchiorrepaulox@fosstodon.org
2023-09-21

I found my first bug in Django 5.0 after the feature freeze 🐛

It's related to GeneratedField and JSONField and maybe you can help to fix it 👇
code.djangoproject.com/ticket/

#django #django5 #bug #generatedfield #jsonfield #json #sql #orm #migrations

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst