def system_log(): user = auth.is_logged_in(request) permission = auth.is_sys_admin(user) log = Log.select().order_by(Log.date.desc(), Log.id.desc()) return listing(request, None, log, 'system_log', 'system_log', user=user)
def index(): time_deposits = TimeDeposit.select().where( (TimeDeposit.terminal_date <= datetime.now()) & (TimeDeposit.deleted == False)).execute() for time_deposit in time_deposits: Account.update(account=Account.balance + (time_deposit.amount * time_deposit.interest) + time_deposit.amount).where( Account.account_number == time_deposit.account_number).execute() TimeDeposit.update(deleted=True).where( TimeDeposit.id == time_deposit.id).execute() try: log = (Log.select().where((Log.action == 'LOGIN') & ( Log.user_id == session['user']['id'])).order_by( Log.created_at.desc()).get() ).created_at.strftime('%d %B %Y %I:%M %p') except DoesNotExist: log = None return render_template('main/index.html', log=log)