Databases

Django attempts to support as many features as possible on all database backends. However, not all database backends are alike, and we’ve had to make design decisions on which features to support and which assumptions we can make safely. This file describes some of the features that might be relevant to Django usage. Of course, it is not intended as a replacement for server-specific documentation or reference manuals. General notes Persistent connections Persistent connections avoid the overhea

views.generic.edit.ModelFormMixin.model

model A model class. Can be explicitly provided, otherwise will be determined by examining self.object or queryset.

core.files.uploadhandler.MemoryFileUploadHandler

class MemoryFileUploadHandler [source] File upload handler to stream uploads into memory (used for small files).

dispatch.Signal.send_robust()

Signal.send_robust(sender, **kwargs) [source] To send a signal, call either Signal.send() (all built-in signals use this) or Signal.send_robust(). You must provide the sender argument (which is a class most of the time) and may provide as many other keyword arguments as you like. For example, here’s how sending our pizza_done signal might look: class PizzaStore(object): ... def send_pizza(self, toppings, size): pizza_done.send(sender=self.__class__, toppings=toppings, size=s

core.files.uploadhandler.FileUploadHandler.upload_complete()

FileUploadHandler.upload_complete() [source] Callback signaling that the entire upload (all files) has completed.

core.files.uploadedfile.UploadedFile.chunks()

UploadedFile.chunks(chunk_size=None) A generator returning chunks of the file. If multiple_chunks() is True, you should use this method in a loop instead of read(). In practice, it’s often easiest simply to use chunks() all the time. Looping over chunks() instead of using read() ensures that large files don’t overwhelm your system’s memory. Here are some useful attributes of UploadedFile:

views.decorators.csrf.csrf_exempt()

csrf_exempt(view) [source] This decorator marks a view as being exempt from the protection ensured by the middleware. Example: from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse @csrf_exempt def my_view(request): return HttpResponse('Hello world')

core.files.storage.FileSystemStorage.base_url

base_url URL that serves the files stored at this location. Defaults to the value of your MEDIA_URL setting.

utils.timezone.is_aware()

is_aware(value) [source] Returns True if value is aware, False if it is naive. This function assumes that value is a datetime.

utils.timezone.get_current_timezone_name()

get_current_timezone_name() [source] Returns the name of the current time zone.