db.models.Model.refresh_from_db()

Model.refresh_from_db(using=None, fields=None) [source] If you need to reload a model’s values from the database, you can use the refresh_from_db() method. When this method is called without arguments the following is done: All non-deferred fields of the model are updated to the values currently present in the database. The previously loaded related instances for which the relation’s value is no longer valid are removed from the reloaded instance. For example, if you have a foreign key from

db.migrations.operations.RunPython

class RunPython(code, reverse_code=None, atomic=None, hints=None, elidable=False) [source] Runs custom Python code in a historical context. code (and reverse_code if supplied) should be callable objects that accept two arguments; the first is an instance of django.apps.registry.Apps containing historical models that match the operation’s place in the project history, and the second is an instance of SchemaEditor. The reverse_code argument is called when unapplying migrations. This callable s

template.Context.flatten()

Context.flatten() Using flatten() method you can get whole Context stack as one dictionary including builtin variables. >>> c = Context() >>> c['foo'] = 'first level' >>> c.update({'bar': 'second level'}) {'bar': 'second level'} >>> c.flatten() {'True': True, 'None': None, 'foo': 'first level', 'False': False, 'bar': 'second level'} A flatten() method is also internally used to make Context objects comparable. >>> c1 = Context() >>> c1['

gis.gdal.OGRGeometry.geom_type

geom_type Returns the type of this geometry, as an OGRGeomType object.

gis.admin.GeoModelAdmin

class GeoModelAdmin default_lon The default center longitude. default_lat The default center latitude. default_zoom The default zoom level to use. Defaults to 18. extra_js Sequence of URLs to any extra JavaScript to include. map_template Override the template used to generate the JavaScript slippy map. Default is 'gis/admin/openlayers.html'. map_width Width of the map, in pixels. Defaults to 600. map_height Height of the map, in pixels. Defaults to 400. op

sessions.backends.base.SessionBase.clear_expired()

clear_expired() Removes expired sessions from the session store. This class method is called by clearsessions.

core.management.BaseCommand.output_transaction

BaseCommand.output_transaction A boolean indicating whether the command outputs SQL statements; if True, the output will automatically be wrapped with BEGIN; and COMMIT;. Default value is False.

auth.models.User.get_all_permissions()

get_all_permissions(obj=None) Returns a set of permission strings that the user has, both through group and user permissions. If obj is passed in, only returns the permissions for this specific object.

views.generic.list.MultipleObjectMixin.paginate_by

paginate_by An integer specifying how many objects should be displayed per page. If this is given, the view will paginate objects with paginate_by objects per page. The view will expect either a page query string parameter (via request.GET) or a page variable specified in the URLconf.

db.models.functions.Lower

class Lower(expression, **extra) [source] Accepts a single text field or expression and returns the lowercase representation. It can also be registered as a transform as described in Length. Usage example: >>> from django.db.models.functions import Lower >>> Author.objects.create(name='Margaret Smith') >>> author = Author.objects.annotate(name_lower=Lower('name')).get() >>> print(author.name_lower) margaret smith Changed in Django 1.9: The ability to reg