Limited lines to 119 characters in django/{contrib,db}.

Refs #23395.

https://code.djangoproject.com/ticket/23395
use parentheses to avoid backslashes and I would also try to keep the comprehension on a single line as breaking it up like this makes readability more difficult IMO.