fixes #20486

Ticket found here: https://code.djangoproject.com/ticket/20486