id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 4427,daily_cleanup.py should use database API,nick.lane.au@…,Adrian Holovaty,"The {{{django/bin/daily_cleanup.py}}} script currently uses custom SQL to delete expired session objects. I think it would be neater to use the database API to bulk delete the query set. For example: {{{ cursor = connection.cursor() cursor.execute(""DELETE FROM %s WHERE %s < NOW()"" % \ (backend.quote_name('django_session'), backend.quote_name('expire_date'))) }}} would become: {{{ Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete() }}} This also has the additional benefit of working in SQLite, whereas with the custom SQL I get the error: {{{sqlite3.OperationalError: no such function: NOW}}}",,closed,Tools,dev,,fixed,,,Ready for checkin,1,0,0,0,0,0