sessions.backends.base.SessionBase.flush()

flush() Deletes the current session data from the session and deletes the session cookie. This is used if you want to ensure that the previous session data can’t be accessed again from the user’s browser (for example, the django.contrib.auth.logout() function calls it).

sessions.backends.base.SessionBase.delete_test_cookie()

delete_test_cookie() Deletes the test cookie. Use this to clean up after yourself.

sessions.backends.base.SessionBase.cycle_key()

cycle_key() Creates a new session key while retaining the current session data. django.contrib.auth.login() calls this method to mitigate against session fixation.

sessions.backends.base.SessionBase.clear_expired()

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

sessions.backends.base.SessionBase.clear()

clear() It also has these methods:

sessions.backends.base.SessionBase

class backends.base.SessionBase This is the base class for all session objects. It has the following standard dictionary methods: __getitem__(key) Example: fav_color = request.session['fav_color'] __setitem__(key, value) Example: request.session['fav_color'] = 'blue' __delitem__(key) Example: del request.session['fav_color']. This raises KeyError if the given key isn’t already in the session. __contains__(key) Example: 'fav_color' in request.session get(key, default=

Security in Django

This document is an overview of Django’s security features. It includes advice on securing a Django-powered site. Cross site scripting (XSS) protection XSS attacks allow a user to inject client side scripts into the browsers of other users. This is usually achieved by storing the malicious scripts in the database where it will be retrieved and displayed to other users, or by getting users to click a link which will cause the attacker’s JavaScript to be executed by the user’s browser. However, X

Search

A common task for web applications is to search some data in the database with user input. In a simple case, this could be filtering a list of objects by a category. A more complex use case might require searching with weighting, categorization, highlighting, multiple languages, and so on. This document explains some of the possible use cases and the tools you can use. We’ll refer to the same models used in Making queries. Use Cases Standard textual queries Text-based fields have a selection of

Running Django on Jython

Jython is an implementation of Python that runs on the Java platform (JVM). This document will get you up and running with Django on top of Jython. Installing Jython Django works with Jython versions 2.7b2 and higher. See the Jython website for download and installation instructions. Creating a servlet container If you just want to experiment with Django, skip ahead to the next section; Django includes a lightweight Web server you can use for testing, so you won’t need to set up anything else u

redirects.models.Redirect

class models.Redirect Redirects are represented by a standard Django model, which lives in django/contrib/redirects/models.py. You can access redirect objects via the Django database API.