| 1 | 10c10,13
|
|---|
| 2 | < from django.db import backend, connection, transaction
|
|---|
| 3 | ---
|
|---|
| 4 | > import datetime
|
|---|
| 5 | > from django.db import transaction
|
|---|
| 6 | > from django.contrib.sessions.models import Session
|
|---|
| 7 | >
|
|---|
| 8 | 13,16c16,17
|
|---|
| 9 | < # Clean up old database records
|
|---|
| 10 | < cursor = connection.cursor()
|
|---|
| 11 | < cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
|
|---|
| 12 | < (backend.quote_name('django_session'), backend.quote_name('expire_date')))
|
|---|
| 13 | ---
|
|---|
| 14 | > # Clean up expired sessions.
|
|---|
| 15 | > Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
|
|---|