perf: 修改 asset 结构

This commit is contained in:
ibuler
2022-09-21 11:17:14 +08:00
parent cf5c50b343
commit 1b0195cb82
37 changed files with 95 additions and 109 deletions

View File

@@ -36,13 +36,13 @@ def write_content_to_excel(response, header=None, login_logs=None, fields=None):
def write_login_log(*args, **kwargs):
from audits.models import UserLoginLog
ip = kwargs.get('ip') or ''
ip = kwargs.get('address') or ''
if not (ip and validate_ip(ip)):
ip = ip[:15]
city = DEFAULT_CITY
else:
city = get_ip_city(ip) or DEFAULT_CITY
kwargs.update({'ip': ip, 'city': city})
kwargs.update({'address': ip, 'city': city})
UserLoginLog.objects.create(**kwargs)