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
Loading
Please register or sign in to comment