forms.Widget.value_omitted_from_data()

value_omitted_from_data(data, files, name) [source] New in Django 1.10.2. Given data and files dictionaries and this widget’s name, returns whether or not there’s data or files for the widget. The method’s result affects whether or not a field in a model form falls back to its default. Special cases are CheckboxInput and CheckboxSelectMultiple, which always return False because an unchecked checkbox doesn’t appear in the data of an HTML form submission, so it’s unknown whether or not the u

admin.ModelAdmin.object_history_template

ModelAdmin.object_history_template Path to a custom template, used by history_view().

db.models.Field.error_messages

Field.error_messages The error_messages argument lets you override the default messages that the field will raise. Pass in a dictionary with keys matching the error messages you want to override. Error message keys include null, blank, invalid, invalid_choice, unique, and unique_for_date. Additional error message keys are specified for each field in the Field types section below.

forms.CharField.min_length

min_length If provided, these arguments ensure that the string is at most or at least the given length.

db.models.fields.files.FieldFile.close()

FieldFile.close() [source] Behaves like the standard Python file.close() method and closes the file associated with this instance.

template.Context.setdefault()

Context.setdefault(key, default=None) New in Django 1.9. If key is in the context, returns its value. Otherwise inserts key with a value of default and returns default.

db.models.functions.Cast

class Cast(expression, output_field) [source] New in Django 1.10. Forces the result type of expression to be the one from output_field. Usage example: >>> from django.db.models import FloatField >>> from django.db.models.functions import Cast >>> Value.objects.create(integer=4) >>> value = Value.objects.annotate(as_float=Cast('integer', FloatField())).get() >>> print(value.as_float) 4.0

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.

db.models.query.QuerySet.latest()

latest(field_name=None) Returns the latest object in the table, by date, using the field_name provided as the date field. This example returns the latest Entry in the table, according to the pub_date field: Entry.objects.latest('pub_date') If your model’s Meta specifies get_latest_by, you can leave off the field_name argument to earliest() or latest(). Django will use the field specified in get_latest_by by default. Like get(), earliest() and latest() raise DoesNotExist if there is no objec

syndication.Feed.get_context_data()

Feed.get_context_data(**kwargs) There is also a way to pass additional information to title and description templates, if you need to supply more than the two variables mentioned before. You can provide your implementation of get_context_data method in your Feed subclass. For example: from mysite.models import Article from django.contrib.syndication.views import Feed class ArticlesFeed(Feed): title = "My articles" description_template = "feeds/articles.html" def items(self):