Skip to content

Commit 3c2b5a2

Browse files
committed
增加ua解析记录
1 parent 4583a17 commit 3c2b5a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

blog/documents.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from elasticsearch_dsl.connections import connections
1515
import time
1616
from blog.models import Article
17-
from elasticsearch_dsl import Document, InnerDoc, Date, Integer, Long, Text, Object, GeoPoint, Keyword
17+
from elasticsearch_dsl import Document, InnerDoc, Date, Integer, Long, Text, Object, GeoPoint, Keyword, Boolean
1818

1919
from django.conf import settings
2020

@@ -71,6 +71,7 @@ class UserAgent(InnerDoc):
7171
os = Object(UserAgentOS, required=False)
7272
device = Object(UserAgentDevice, required=False)
7373
string = Text()
74+
is_bot = Boolean()
7475

7576

7677
class ElapsedTimeDocument(Document):
@@ -121,6 +122,7 @@ def create(url, time_taken, log_datetime, useragent, ip):
121122
ua.device.Brand = useragent.device.brand
122123
ua.device.Model = useragent.device.model
123124
ua.string = useragent.ua_string
125+
ua.is_bot = useragent.is_bot
124126

125127
doc = ElapsedTimeDocument(
126128
meta={

0 commit comments

Comments
 (0)