forms.RegexField.strip

strip New in Django 1.9. Defaults to False. If enabled, stripping will be applied before the regex validation.

Internationalization and localization

Overview The goal of internationalization and localization is to allow a single Web application to offer its content in languages and formats tailored to the audience. Django has full support for translation of text, formatting of dates, times and numbers, and time zones. Essentially, Django does two things: It allows developers and template authors to specify which parts of their apps should be translated or formatted for local languages and cultures. It uses these hooks to localize Web apps f

core.files.images.ImageFile

class ImageFile(file_object) [source] Django provides a built-in class specifically for images. django.core.files.images.ImageFile inherits all the attributes and methods of File, and additionally provides the following: width Width of the image in pixels. height Height of the image in pixels.

utils.http.cookie_date()

cookie_date(epoch_seconds=None) [source] Formats the time to ensure compatibility with Netscape’s cookie standard. Accepts a floating point number expressed in seconds since the epoch in UTC–such as that outputted by time.time(). If set to None, defaults to the current time. Outputs a string in the format Wdy, DD-Mon-YYYY HH:MM:SS GMT.

views.decorators.http.require_GET()

require_GET() Decorator to require that a view only accepts the GET method.

forms.BoundField.data

BoundField.data This property returns the data for this BoundField extracted by the widget’s value_from_datadict() method, or None if it wasn’t given: >>> unbound_form = ContactForm() >>> print(unbound_form['subject'].data) None >>> bound_form = ContactForm(data={'subject': 'My Subject'}) >>> print(bound_form['subject'].data) My Subject

utils.encoding.force_unicode()

force_unicode(s, encoding='utf-8', strings_only=False, errors='strict') Historical name of force_text(). Only available under Python 2.

http.FileResponse

class FileResponse [source] FileResponse is a subclass of StreamingHttpResponse optimized for binary files. It uses wsgi.file_wrapper if provided by the wsgi server, otherwise it streams the file out in small chunks. FileResponse expects a file open in binary mode like so: >>> from django.http import FileResponse >>> response = FileResponse(open('myfile.png', 'rb'))

views.generic.base.TemplateResponseMixin.render_to_response()

render_to_response(context, **response_kwargs) Returns a self.response_class instance. If any keyword arguments are provided, they will be passed to the constructor of the response class. Calls get_template_names() to obtain the list of template names that will be searched looking for an existent template.

forms.RegexField.regex

regex A regular expression specified either as a string or a compiled regular expression object. Also takes max_length, min_length, and strip, which work just as they do for CharField.