<s> import datetime <EOL> from django . conf import settings <EOL> from django . contrib import admin <EOL> from . models import LazyUser <EOL> @ admin . register ( LazyUser ) <EOL> class LazyUserAdmin ( admin . ModelAdmin ) : <EOL> list_display = ( '<STR_LIT:user>' , '<STR_LIT>' , ) <EOL> actions = ( '<STR_LIT>' , ) <EOL> def cleanup_lazyusers ( self , request , queryset ) : <EOL> delete_before = datetime . datetime . now ( ) - datetime . timedelta ( <EOL> seconds = settings . SESSION_COOKIE_AGE ) <EOL> old_users = queryset . filter ( user__last_login__lt = delete_before ) <EOL> count = old_users . count ( ) <EOL> for lazy_user in old_users : <EOL> lazy_user . user . delete ( ) <EOL> self . message_user ( request , "<STR_LIT>" . format ( count ) ) <EOL> cleanup_lazyusers . short_description = ( <EOL> '<STR_LIT>' . format ( <EOL> datetime . timedelta ( seconds = settings . SESSION_COOKIE_AGE ) <EOL> ) <EOL> ) </s>
