Articles tagged with django

  1. You might as well timestamp more things

    Published:

    You might as well timestamp it was a post doing the rounds a few years ago. It suggests using timestamps rather than booleans just to have the extra data point of when something happened.

    Lately I found myself in a different, but related situation. I had something like the following …

  2. Faster migration tests

    Published:

    Almost invariably when I start to work at a new company, I look at the project configuration and find something like this:

    [tool.coverage.run]
    branch = true
    omit = ["**/migrations/*"]
    
    [tool.ruff]
    exclude = ["**/migrations/*"]
    

    My suspicion about how prevalent this is is confirmed by GitHub Copilot suggesting it to me the …

  3. Ensuring a block is overridden in a Django template

    Published:

    Some bugs are hard to even notice. For example, what if you forgot to add a title to one of your web pages? Oops! You're probably left with a generic title of only your site name, or worse, no title at all. And it's very tricky to spot this. Most …

  4. Testing Django data migrations

    Published: | Updated:

    You probably already know the value of testing your code. Your Django migrations are code, therefore you should test them. However, testing data migrations in particular can be tricky, and there's no documentation on how to do it.

    Typically your schema migrations don't need any testing as your migrations are …