core.checks.Error

class Error(msg, hint=None, obj=None, id=None) [source]

core.checks.Debug

class Debug(msg, hint=None, obj=None, id=None) [source]

core.checks.Critical

class Critical(msg, hint=None, obj=None, id=None) [source]

core.checks.CheckMessage

class CheckMessage(level, msg, hint=None, obj=None, id=None) [source] The warnings and errors raised by system checks must be instances of CheckMessage. An instance encapsulates a single reportable error or warning. It also provides context and hints applicable to the message, and a unique identifier that is used for filtering purposes. Constructor arguments are:

core.cache.utils.make_template_fragment_key()

django.core.cache.utils.make_template_fragment_key(fragment_name, vary_on=None) If you want to obtain the cache key used for a cached fragment, you can use make_template_fragment_key. fragment_name is the same as second argument to the cache template tag; vary_on is a list of all additional arguments passed to the tag. This function can be useful for invalidating or overwriting a cached item, for example: >>> from django.core.cache import cache >>> from django.core.cache.ut

contrib packages

Django aims to follow Python’s “batteries included” philosophy. It ships with a variety of extra, optional tools that solve common Web-development problems. This code lives in django/contrib in the Django distribution. This document gives a rundown of the packages in contrib, along with any dependencies those packages have. Note For most of these add-ons – specifically, the add-ons that include either models or template tags – you’ll need to add the package name (e.g., 'django.contrib.redirect

contenttypes.models.ContentTypeManager.get_for_models()

get_for_models(*models, for_concrete_models=True) Takes a variadic number of model classes, and returns a dictionary mapping the model classes to the ContentType instances representing them. for_concrete_models=False allows fetching the ContentType of proxy models.

contenttypes.models.ContentTypeManager.get_for_model()

get_for_model(model, for_concrete_model=True) Takes either a model class or an instance of a model, and returns the ContentType instance representing that model. for_concrete_model=False allows fetching the ContentType of a proxy model.

contenttypes.models.ContentTypeManager.get_for_id()

get_for_id(id) Lookup a ContentType by ID. Since this method uses the same shared cache as get_for_model(), it’s preferred to use this method over the usual ContentType.objects.get(pk=id)

contenttypes.models.ContentTypeManager.get_by_natural_key()

get_by_natural_key(app_label, model) Returns the ContentType instance uniquely identified by the given application label and model name. The primary purpose of this method is to allow ContentType objects to be referenced via a natural key during deserialization.