db.models.OneToOneField

class OneToOneField(othermodel, on_delete, parent_link=False, **options) [source] A one-to-one relationship. Conceptually, this is similar to a ForeignKey with unique=True, but the “reverse” side of the relation will directly return a single object. Changed in Django 1.9: on_delete can now be used as the second positional argument (previously it was typically only passed as a keyword argument). It will be a required argument in Django 2.0. This is most useful as the primary key of a model

core.files.uploadhandler.FileUploadHandler.new_file()

FileUploadHandler.new_file(field_name, file_name, content_type, content_length, charset, content_type_extra) [source] Callback signaling that a new file upload is starting. This is called before any data has been fed to any upload handlers. field_name is a string name of the file <input> field. file_name is the unicode filename that was provided by the browser. content_type is the MIME type provided by the browser – E.g. 'image/jpeg'. content_length is the length of the image given by

db.models.Model.full_clean()

Model.full_clean(exclude=None, validate_unique=True) [source] This method calls Model.clean_fields(), Model.clean(), and Model.validate_unique() (if validate_unique is True), in that order and raises a ValidationError that has a message_dict attribute containing errors from all three stages. The optional exclude argument can be used to provide a list of field names that can be excluded from validation and cleaning. ModelForm uses this argument to exclude fields that aren’t present on your fo

views.generic.dates.WeekMixin

class WeekMixin [source] A mixin that can be used to retrieve and provide parsing information for a week component of a date. Methods and Attributes week_format The strftime() format to use when parsing the week. By default, this is '%U', which means the week starts on Sunday. Set it to '%W' if your week starts on Monday. week Optional The value for the week, as a string. By default, set to None, which means the week will be determined using other means. get_week_format() [sourc

db.models.Field.get_db_prep_value()

get_db_prep_value(value, connection, prepared=False) [source] Converts value to a backend-specific value. By default it returns value if prepared=True and get_prep_value() if is False. See Converting query values to database values for usage. When loading data, from_db_value() is used:

test.runner.DiscoverRunner.setup_databases()

DiscoverRunner.setup_databases(**kwargs) Creates the test databases. Returns a data structure that provides enough detail to undo the changes that have been made. This data will be provided to the teardown_databases() function at the conclusion of testing.

views.generic.list.MultipleObjectMixin.queryset

queryset A QuerySet that represents the objects. If provided, the value of queryset supersedes the value provided for model. Warning queryset is a class attribute with a mutable value so care must be taken when using it directly. Before using it, either call its all() method or retrieve it with get_queryset() which takes care of the cloning behind the scenes.

forms.FilePathField.allow_files

allow_files Optional. Either True or False. Default is True. Specifies whether files in the specified location should be included. Either this or allow_folders must be True.

postgres.fields.ArrayField.base_field

base_field This is a required argument. Specifies the underlying data type and behavior for the array. It should be an instance of a subclass of Field. For example, it could be an IntegerField or a CharField. Most field types are permitted, with the exception of those handling relational data (ForeignKey, OneToOneField and ManyToManyField). It is possible to nest array fields - you can specify an instance of ArrayField as the base_field. For example: from django.db import models from django.

Writing your first patch for Django

Introduction Interested in giving back to the community a little? Maybe you’ve found a bug in Django that you’d like to see fixed, or maybe there’s a small feature you want added. Contributing back to Django itself is the best way to see your own concerns addressed. This may seem daunting at first, but it’s really pretty simple. We’ll walk you through the entire process, so you can learn by example. Who’s this tutorial for? See also If you are looking for a reference on how to submit patches,