Fix NoneType error when fetching a stale ContentType with get_for_id

When a stale ContentType is fetched, the _add_to_cache() function
didn't detect that `model_class()` returns `None` (which it does by
design). However, the `app_label` + `model` fields can be used instead
to as local cache key. Third party apps can detect stale models by
checking whether `model_class()` returns `None`.

Ticket: https://code.djangoproject.com/ticket/20442
Merge pull request #1130 from vdboor/issue_20442_get_for_id

Fixed #20442: NoneType error when fetching a stale ContentType with get_for_id