db.models.fields.related.RelatedManager.set()

set(objs, bulk=True, clear=False) New in Django 1.9. Replace the set of related objects: >>> new_list = [obj1, obj2, obj3] >>> e.related_set.set(new_list) This method accepts a clear argument to control how to perform the operation. If False (the default), the elements missing from the new set are removed using remove() and only the new ones are added. If clear=True, the clear() method is called instead and the whole set is added at once. The bulk argument is passed on t

db.models.Field.default

Field.default The default value for the field. This can be a value or a callable object. If callable it will be called every time a new object is created. The default can’t be a mutable object (model instance, list, set, etc.), as a reference to the same instance of that object would be used as the default value in all new model instances. Instead, wrap the desired default in a callable. For example, if you want to specify a default dict for JSONField, use a function: def contact_default():

views.decorators.http.require_http_methods()

require_http_methods(request_method_list) [source] Decorator to require that a view only accepts particular request methods. Usage: from django.views.decorators.http import require_http_methods @require_http_methods(["GET", "POST"]) def my_view(request): # I can assume now that only GET or POST requests make it this far # ... pass Note that request methods should be in uppercase.

admin.apps.AdminConfig

class apps.AdminConfig This is the default AppConfig class for the admin. It calls autodiscover() when Django starts.

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.

core.files.uploadedfile.UploadedFile

class UploadedFile [source] During file uploads, the actual file data is stored in request.FILES. Each entry in this dictionary is an UploadedFile object (or a subclass) – a simple wrapper around an uploaded file. You’ll usually use one of these methods to access the uploaded content:

core.mail.send_mail()

send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None, connection=None, html_message=None) [source] The simplest way to send email is using django.core.mail.send_mail(). The subject, message, from_email and recipient_list parameters are required. subject: A string. message: A string. from_email: A string. recipient_list: A list of strings, each an email address. Each member of recipient_list will see the other recipients in the “T

core.management.BaseCommand.execute()

BaseCommand.execute(*args, **options) [source] Tries to execute this command, performing system checks if needed (as controlled by the requires_system_checks attribute). If the command raises a CommandError, it’s intercepted and printed to stderr. Calling a management command in your code execute() should not be called directly from your code to execute a command. Use call_command() instead.

core.management.BaseCommand.requires_migrations_checks

BaseCommand.requires_migrations_checks New in Django 1.10. A boolean; if True, the command prints a warning if the set of migrations on disk don’t match the migrations in the database. A warning doesn’t prevent the command from executing. Default value is False.

gis.geos.LineString.closed

closed New in Django 1.10. Returns whether or not this LineString is closed.