File Uploads

When Django handles a file upload, the file data ends up placed in request.FILES (for more on the request object see the documentation for request and response objects). This document explains how files are stored on disk and in memory, and how to customize the default behavior. Warning There are security risks if you are accepting uploaded content from untrusted users! See the security guide’s topic on User-uploaded content for mitigation details. Basic file uploads Consider a simple form co

core.management.AppCommand.handle_app_config()

AppCommand.handle_app_config(app_config, **options) Perform the command’s actions for app_config, which will be an AppConfig instance corresponding to an application label given on the command line.

gis.gdal.Layer.field_precisions

field_precisions Returns a list of the numeric precisions for each of the fields in this layer. This is meaningless (and set to zero) for non-numeric fields: >>> layer.field_precisions [0, 0, 15, 0]

gis.geos.LinearRing

class LinearRing(*args, **kwargs) LinearRing objects are constructed in the exact same way as LineString objects, however the coordinates must be closed, in other words, the first coordinates must be the same as the last coordinates. For example: >>> ls = LinearRing((0, 0), (0, 1), (1, 1), (0, 0)) Notice that (0, 0) is the first and last coordinate – if they were not equal, an error would be raised.

views.generic.dates.DateMixin.get_allow_future()

get_allow_future() [source] Determine whether to include “future” objects on this page, where “future” means objects in which the field specified in date_field is greater than the current date/time. Returns allow_future by default.

db.models.query.QuerySet.filter()

filter(**kwargs) Returns a new QuerySet containing objects that match the given lookup parameters. The lookup parameters (**kwargs) should be in the format described in Field lookups below. Multiple parameters are joined via AND in the underlying SQL statement. If you need to execute more complex queries (for example, queries with OR statements), you can use Q objects.

admin.AdminSite.login_form

AdminSite.login_form Subclass of AuthenticationForm that will be used by the admin site login view.

test.TransactionTestCase.reset_sequences

TransactionTestCase.reset_sequences Setting reset_sequences = True on a TransactionTestCase will make sure sequences are always reset before the test run: class TestsThatDependsOnPrimaryKeySequences(TransactionTestCase): reset_sequences = True def test_animal_pk(self): lion = Animal.objects.create(name="lion", sound="roar") # lion.pk is guaranteed to always be 1 self.assertEqual(lion.pk, 1) Unless you are explicitly testing primary keys sequence numbers, it

db.models.Options.base_manager_name

Options.base_manager_name New in Django 1.10. The name of the manager to use for the model’s _base_manager.

gis.db.models.MultiPolygonField

class MultiPolygonField