Fix missing PK field

Add this fix:
https://github.com/django/django/commit/3aad955ea8db1592fad0012155eaa25b72e50dc5

For these issues:
https://code.djangoproject.com/ticket/13696
https://code.djangoproject.com/ticket/12235