forms.Form.as_p()

Form.as_p() as_p() renders the form as a series of <p> tags, with each <p> containing one field: >>> f = ContactForm() >>> f.as_p() '<p><label for="id_subject">Subject:</label> <input id="id_subject" type="text" name="subject" maxlength="100" required /></p>\n<p><label for="id_message">Message:</label> <input type="text" name="message" id="id_message" required /></p>\n<p><label for="id_sender"&

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.

views.generic.dates.YearMixin.year_format

year_format The strftime() format to use when parsing the year. By default, this is '%Y'.

forms.SelectDateWidget

class SelectDateWidget [source] Wrapper around three Select widgets: one each for month, day, and year. Takes several optional arguments: years An optional list/tuple of years to use in the “year” select box. The default is a list containing the current year and the next 9 years. months An optional dict of months to use in the “months” select box. The keys of the dict correspond to the month number (1-indexed) and the values are the displayed months: MONTHS = { 1:_('jan'), 2:_('