staticfiles.storage.ManifestStaticFilesStorage.file_hash()

storage.ManifestStaticFilesStorage.file_hash(name, content=None) The method that is used when creating the hashed name of a file. Needs to return a hash for the given file name and content. By default it calculates a MD5 hash from the content’s chunks as mentioned above. Feel free to override this method to use your own hashing algorithm.

db.models.Field.from_db_value()

from_db_value(value, expression, connection, context) Converts a value as returned by the database to a Python object. It is the reverse of get_prep_value(). This method is not used for most built-in fields as the database backend already returns the correct Python type, or the backend itself does the conversion. See Converting values to Python objects for usage. Note For performance reasons, from_db_value is not implemented as a no-op on fields which do not require it (all Django fields).

gis.gdal.SpatialReference.identify_epsg()

identify_epsg() This method inspects the WKT of this SpatialReference and will add EPSG authority nodes where an EPSG identifier is applicable.

test.override_settings()

override_settings() [source] In case you want to override a setting for a test method, Django provides the override_settings() decorator (see PEP 318). It’s used like this: from django.test import TestCase, override_settings class LoginTestCase(TestCase): @override_settings(LOGIN_URL='/other/login/') def test_login(self): response = self.client.get('/sekrit/') self.assertRedirects(response, '/other/login/?next=/sekrit/') The decorator can also be applied to TestCas

apps.AppConfig.get_model()

AppConfig.get_model(model_name) [source] Returns the Model with the given model_name. Raises LookupError if no such model exists in this application. model_name is case-insensitive.

template.loaders.base.Loader.get_template()

get_template(template_name, skip=None) [source] Returns a Template object for a given template_name by looping through results from get_template_sources() and calling get_contents(). This returns the first matching template. If no template is found, TemplateDoesNotExist is raised. The optional skip argument is a list of origins to ignore when extending templates. This allow templates to extend other templates of the same name. It also used to avoid recursion errors. In general, it is enough

core.validators.RegexValidator

class RegexValidator(regex=None, message=None, code=None, inverse_match=None, flags=0) [source] Parameters: regex – If not None, overrides regex. Can be a regular expression string or a pre-compiled regular expression. message – If not None, overrides message. code – If not None, overrides code. inverse_match – If not None, overrides inverse_match. flags – If not None, overrides flags. In that case, regex must be a regular expression string, or TypeError is raised. regex The regu

utils.translation.ungettext_lazy()

ungettext_lazy(singular, plural, number) [source]

forms.Form.errors

Form.errors Access the errors attribute to get a dictionary of error messages: >>> f.errors {'sender': ['Enter a valid email address.'], 'subject': ['This field is required.']} In this dictionary, the keys are the field names, and the values are lists of Unicode strings representing the error messages. The error messages are stored in lists because a field can have multiple error messages. You can access errors without having to call is_valid() first. The form’s data will be valida

db.models.Options.order_with_respect_to

Options.order_with_respect_to Makes this object orderable with respect to the given field, usually a ForeignKey. This can be used to make related objects orderable with respect to a parent object. For example, if an Answer relates to a Question object, and a question has more than one answer, and the order of answers matters, you’d do this: from django.db import models class Question(models.Model): text = models.TextField() # ... class Answer(models.Model): question = models.Fo