Skip to content

Instantly share code, notes, and snippets.

@mehdimehdi
Created July 29, 2014 17:15
Show Gist options
  • Save mehdimehdi/3824b9576c25d4a04626 to your computer and use it in GitHub Desktop.
Save mehdimehdi/3824b9576c25d4a04626 to your computer and use it in GitHub Desktop.
from django.db import transaction
from django.contrib.sessions.models import Session
Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
transaction.commit_unless_managed()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment