File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,14 @@ def __str__(self):
5656 return six .text_type (self .id )
5757
5858 def update_attributes (self , request ):
59- self .ip_address = request .META .get ('HTTP_X_FORWARDED_FOR' ) \
60- if request .META .get ('HTTP_X_FORWARDED_FOR' ) \
61- else request .META .get ('REMOTE_ADDR' )
62- self .user_agent = request .META .get ('HTTP_USER_AGENT' )[:1000 ]
59+ if request .META .get ('HTTP_X_FORWARDED_FOR' ):
60+ self .ip_address = request .META .get ('HTTP_X_FORWARDED_FOR' )
61+ elif request .META .get ('REMOTE_ADDR' ):
62+ self .ip_address = request .META .get ('REMOTE_ADDR' )
63+ else :
64+ self .ip_address = None
65+
66+ if request .META .get ('HTTP_USER_AGENT' ):
67+ self .user_agent = request .META .get ('HTTP_USER_AGENT' )[:1000 ]
68+ else :
69+ self .user_agent = ''
You can’t perform that action at this time.
0 commit comments