←back to thread

Happy 20th Birthday, Django

(www.djangoproject.com)
578 points davepeck | 1 comments | | HN request time: 0.306s | source
Show context
insin ◴[] No.44570589[source]
Happy birthday, Django. I've used, read and loved just about every part of you from the magic-removal days onwards when I had the Rails book on my desk and your docs in my browser, and you (and Python) won. I loved spending thousands of lines in a models.py modelling all sorts of problems before I touched a single line of other code. You got me into open source and then you got me into writing JavaScript seriously via the first large library I ever wrote in it (a port of what was then django.newforms - thanks and vale, Malcolm - for Node.js and the browser). You're my favourite framework I haven't actually used for a decade.

Django's docs can't be praised enough, they've always been the gold standard that I aspire to, taking a similar approach to documenting my own stuff seriously leveled me up, and great docs written for humans by humans stand out even more amongst the painlessly effortlessly generated slop of the day that's painful and effortful to read.

Template inheritance was so elegant and simple compared to the Java and PHP I was professionally and personally using at the time, but 20 years later and after having used Hono, one thing I'd love to see in Django is... JSX in Python! Imagine:

    def Layout(title: str, children):
      return (
        <html>
          <head>
            <title>{title}</title>
          </head>
          <body>
            <h1>{title}</h1>
            {children}
          </body>
        </html>
      )

    def message_list_view(request):
      messages = ['Good Morning', 'Good Evening', 'Good Night']
      return render(request,
        <Layout title="Messages">
          <ul>
            {[<li>{message}</li> for message in messages]}
          </ul>
        </Layout>
      )
replies(1): >>44571021 #
1. dotandgtfo ◴[] No.44571021[source]
I'm newish to Django. Been using it for about a year. I had some experience with React earlier. But I'm more of a data engineer.

Django Cotton [1] scratched my itch fully. Very composable. Being able to pass HTML to components (E.g. you create a modal which takes a content slot) removed so many of the warts I felt using the standard Django templating.

It's not JSX, but it plays well with Django and makes it feel like I can create a real design system of components without a ton of JINJA.

https://django-cotton.com/