Skip to main content

A Django application to store your previous history and action in your session engine

Project description

Build Status

A Django application to store your previous history and action using differents backends.

With this application you will be able to redirect your users to their previous location when they tried to access a page where the login is required.

http://cl.ly/image/371E2R0L3n2h/backward_redirect.png

You will be also able to record previous action which needed login required.

For example, if your user is not logged in your application and try to execute an action which required authentication (e.g.: an user clicks on a button to follow another user), this application will record parameters (even on POST) and execute the last action when your user will be successfully logged.

http://cl.ly/image/3B2E0H2M0j1C/backward_action.png

Thanks to oleiade for the name.

Compatibility

This library is compatible with:

  • python2.6, django1.4

  • python2.6, django1.5

  • python2.6, django1.6

  • python2.7, django1.4

  • python2.7, django1.5

  • python2.7, django1.6

  • python3.3, django1.5

  • python3.3, django1.6

Installation

  1. Either check out the package from GitHub or it pull from a release via PyPI

    pip install django-backward
  2. Add backward.middleware.BackwardMiddleware to your MIDDLEWARE_CLASSES

    MIDDLEWARE_CLASSES = (
        'backward.middleware.BackwardMiddleware',
    )
  3. Add backward.urls to your urls.py

    # urls.py
    
    from django.conf.urls import patterns, url, include
    
    urlpatterns = patterns(
        '',
    
        url(r'^backward/', include('backward.urls')),
    )
  4. Set settings.LOGIN_REDIRECT_URL as mentioned in your urls.py for example

    # settings.py
    
    LOGIN_REDIRECT_URL = '/backward/login/redirect/'
  5. Configure your Session engine if you are using the default backend

  6. Use the decorator backward.decorators.login_required if your views need authentication

Configuration

BACKEND_BACKEND_CLASS

The backend used to store information.

The default backend class is backward.backends.session.SessionBackend.

backwards.backends.session.SessionBackend

Store information in request.session using your Session engine

backwards.backends.session.CookieBackend

Store information in request.COOKIES, you can configure a few things:

  • BACKWARD_MAX_AGE: the age used to set an expiration date to the cookie

  • BACKWARD_COOKIE_DOMAIN: the domain name used for the cookie

  • BACKWARD_COOKIE_SECURE: if this is set to True, the cookie will be marked as secure, which means browsers may ensure that the cookie is only sent under an HTTPS connection.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-backward-0.3.2.tar.gz (7.9 kB view details)

Uploaded Source

File details

Details for the file django-backward-0.3.2.tar.gz.

File metadata

File hashes

Hashes for django-backward-0.3.2.tar.gz
Algorithm Hash digest
SHA256 5d17ad0e4c52e3335d373f12017e85cf41c43acfff5ed2c60fd25e75542125a5
MD5 cab0447e1a3a273d1043679473a53b24
BLAKE2b-256 cd9f5b15e1caf8fd73c47ddba9e1ae00758077f8ff38e5cb34007dca7b6e1fc9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page