Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def write(db, hits, verbosity=0):
i = len(hits)
hit_objs = []
for hit in hits:
if verbosity > 0 and i > 0:
if verbosity > 2:
print(json.dumps(hit, indent=2))
hit_obj = Hit(
path=hit["path"],
method=hit["method"],
ip=hit["ip"],
user_agent=hit["user_agent"],
authenticated=convertBool(hit["is_authenticated"]),
staff=convertBool(hit["is_staff"]),
superuser=convertBool(hit["is_superuser"]),
username=hit["user"],
referer=hit["referer"],
view=hit["view"],
module=hit["module"],
status_code=int(hit["status_code"]),
reason_phrase=hit["reason_phrase"],
request_time=float(hit["request_time"]),
doc_size=hit["doc_size"],
num_queries=int(hit["num_queries"]),
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Hit
@admin.register(Hit)
class HitAdmin(admin.ModelAdmin):
list_display = (
'created',
'path',
'method',
'ip',
'username',
'device',
'city',
)
list_filter = (
'created',
'edited',
'authenticated',
'staff',
'superuser',