mirror of
https://github.com/openspug/spug.git
synced 2026-01-25 15:02:04 +00:00
8 lines
228 B
Python
8 lines
228 B
Python
from apps.alarm.models import Alarm
|
|
from datetime import datetime, timedelta
|
|
|
|
|
|
def auto_clean_records():
|
|
date = datetime.now() - timedelta(days=30)
|
|
Alarm.objects.filter(created_at__lt=date.strftime('%Y-%m-%d')).delete()
|