db.models.Field.help_text

Field.help_text Extra “help” text to be displayed with the form widget. It’s useful for documentation even if your field isn’t used on a form. Note that this value is not HTML-escaped in automatically-generated forms. This lets you include HTML in help_text if you so desire. For example: help_text="Please use the following format: <em>YYYY-MM-DD</em>." Alternatively you can use plain text and django.utils.html.escape() to escape any HTML special characters. Ensure that you escap

admin.ModelAdmin.get_changeform_initial_data()

ModelAdmin.get_changeform_initial_data(request) [source] A hook for the initial data on admin change forms. By default, fields are given initial values from GET parameters. For instance, ?name=initial_value will set the name field’s initial value to be initial_value. This method should return a dictionary in the form {'fieldname': 'fieldval'}: def get_changeform_initial_data(self, request): return {'name': 'custom_initial_value'}

core.files.storage.Storage.get_accessed_time()

get_accessed_time(name) [source] New in Django 1.10. Returns a datetime of the last accessed time of the file. For storage systems unable to return the last accessed time this will raise NotImplementedError. If USE_TZ is True, returns an aware datetime, otherwise returns a naive datetime in the local timezone.

db.backends.base.schema.BaseDatabaseSchemaEditor.alter_unique_together()

BaseDatabaseSchemaEditor.alter_unique_together(model, old_unique_together, new_unique_together) [source] Changes a model’s unique_together value; this will add or remove unique constraints from the model’s table until they match the new value.

forms.ModelChoiceField

class ModelChoiceField(**kwargs) [source] Default widget: Select Empty value: None Normalizes to: A model instance. Validates that the given id exists in the queryset. Error message keys: required, invalid_choice Allows the selection of a single model object, suitable for representing a foreign key. Note that the default widget for ModelChoiceField becomes impractical when the number of entries increases. You should avoid using it for more than 100 items. A single argument is required:

core.files.uploadedfile.UploadedFile.read()

UploadedFile.read() Read the entire uploaded data from the file. Be careful with this method: if the uploaded file is huge it can overwhelm your system if you try to read it into memory. You’ll probably want to use chunks() instead; see below.

postgres.search.SearchVectorField

class SearchVectorField [source] If this approach becomes too slow, you can add a SearchVectorField to your model. You’ll need to keep it populated with triggers, for example, as described in the PostgreSQL documentation. You can then query the field as if it were an annotated SearchVector: >>> Entry.objects.update(search_vector=SearchVector('body_text')) >>> Entry.objects.filter(search_vector='cheese') [<Entry: Cheese on Toast recipes>, <Entry: Pizza recipes>]

auth.models.UserManager

class models.UserManager The User model has a custom manager that has the following helper methods (in addition to the methods provided by BaseUserManager): create_user(username, email=None, password=None, **extra_fields) Creates, saves and returns a User. The username and password are set as given. The domain portion of email is automatically converted to lowercase, and the returned User object will have is_active set to True. If no password is provided, set_unusable_password() will be c

dispatch.Signal.connect()

Signal.connect(receiver, sender=None, weak=True, dispatch_uid=None) [source] Parameters: receiver – The callback function which will be connected to this signal. See Receiver functions for more information. sender – Specifies a particular sender to receive signals from. See Connecting to signals sent by specific senders for more information. weak – Django stores signal handlers as weak references by default. Thus, if your receiver is a local function, it may be garbage collected. To prev

redirects.models.Redirect

class models.Redirect Redirects are represented by a standard Django model, which lives in django/contrib/redirects/models.py. You can access redirect objects via the Django database API.