Solving bug #21170

This solves https://code.djangoproject.com/ticket/21170