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):

db.models.Options.required_db_vendor

Options.required_db_vendor New in Django 1.9. Name of a supported database vendor that this model is specific to. Current built-in vendor names are: sqlite, postgresql, mysql, oracle. If this attribute is not empty and the current connection vendor doesn’t match it, the model will not be synchronized.

db.models.functions.datetime.TruncMinute

class TruncMinute(expression, output_field=None, tzinfo=None, **extra) [source] kind = 'minute'

db.models.functions.datetime.TruncDate

class TruncDate(expression, **extra) [source] lookup_name = 'date' output_field = DateField() TruncDate casts expression to a date rather than using the built-in SQL truncate function. It’s also registered as a transform on DateTimeField as __date.