This is line 3 of base.html in the current Django repo on GitHub,
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}">
Naturally, PyCharm flags this, and it is easy to see why. Any beginner Python text on strings will tell you that you can use either single or double quotes, but if they overlap, you should wrap double inside single, or vice versa. The same rule applies to html. Here the double quote after html lang is closed on the other side of the }}, making the use of double quotes inside to wrap en-us trigger the PyCharm warning.
However, the error message itself says nothing about quotes, single or double. Clicking on the first one moves the cursor to the colon between default and the next double quote in the string, saying it expected }} - which is correct, since the {{ came right after the first double quote.
I thought it was odd to see such errors in source code, but went ahead with what both PyCharm and I knew was right. But despite all that, none of this is really correct in this instance. In fact, it will throw a big fat 500 error until you put it all back the way it came. And all the traceback will tell you is that there is a TemplateSyntaxError.
Apparently this has something to do with the template language, perhaps overriding all good sense, I don’t know, but that is why I am posting. Could someone here please explain this error and syntax to me?
Thank you.