Nitpicking: there's some double-spacing that's not needed. I would remove the space before the `{% if %}` tag and keep the one inside.

Also, this line seems pretty long now (it's the longest one in the file). Is there a way to split it over several lines while keeping the readability?