←back to thread

Happy 20th Birthday, Django

(www.djangoproject.com)
578 points davepeck | 1 comments | | HN request time: 1.472s | source
Show context
aniforprez ◴[] No.44568432[source]
The only issues I see with Django these days are a lack of native python types and especially these days with type hints included in the language I think there should be efforts taken to have this present within the framework itself. I know there's packages that provide it but I'd prefer if it was coming from Django itself.

Otherwise it's a fantastic framework that's extremely flexible and a joy to work with most of the time. Due to its longevity, it has such a rich ecosystem that's enviable and only mirrored by the likes of rails.

replies(1): >>44568556 #
1. matsemann ◴[] No.44568556[source]
Yeah, to have a properly typed codebase I'm basically isolating the ORM and models from the rest of our app. So there is a selector layer that fetches data, and then maps that do dataclasses/pydantic, instead of passing the django model objects around.

It's a good practice anyways I feel, as the application grows you don't want different "apps" to know too much about models in other apps.

But even with this flow, in my selector layer I still have to do "# type: ignore" any time I've used an annotation. Especially due to python's lacking lambdas, when I map data from a queryset it often has to be a properly defined function, but then whatever annotation django-stubs managed to apply is lost anyways.