Hacker News new | past | comments | ask | show | jobs | submit login

Django makes a lot of use of lazy evaluation. You'll often construct a QuerySet object in a Django view like this:

    entries = Entry.objects.filter(
        category="python"
    ).order_by("-created")[:10]
Then pass that to a template which does this:

    {% for entry in entries %}...
Django doesn't actually execute the SQL query until the template starts looping through it.

Async template rendering becomes necessary if you want the templates to be able to execute async SQL queries in this way.

Jinja has this feature already with the enable_async=True setting - I wrote a tiny bit about that in https://til.simonwillison.net/sqlite/related-content




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: