A reusable Django app that lets you call followup functions after an event has taken place. (Such as two-factor authentication)
in your database to be called once another event has taken place.
In its most basic form, it has two main parts. First, you give
`onetime.call_later` a callable to execute when the event happens.
Second you hook up the CallbackMiddleware which will call the callable
with the arguments you supply to `call_later()`.
# Log a user in via email
from onetime import call_later
def login(request=None, user_id):
user = User.objects.get(id=user_id)
request.session['logged_in_user'] = user
alleged_user = User.objects.get(id=request.GET['user_id'])
onetime_id = call_later(login, user_id=alleged_user.id)
"Login by clicking <a href='http://mysite/?onetime_id=%s'>here</a>"%onetime_id
MIDDLEWARE_CLASSES = (
If the callable you are passing in to call_later is in fact a Django
view that needs its first parameter to be the incoming request, you
can instead use `onetime.call_view_later` which will pass in the subsequent
request as the first parameter to the callable.
ONETIME_REQUEST_PARAMETER The request.REQUEST key we should look under
while searching for OneTime IDs. Can be any url-safe string, defaults
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size django-onetime-0.2.0.tar.gz (5.0 kB)||File type Source||Python version None||Upload date||Hashes View|