obscure browsers and operating systems
This commit is contained in:
parent
46096e4721
commit
eefd1e96e7
1 changed files with 14 additions and 1 deletions
|
@ -44,9 +44,18 @@ class SessionData(models.Model):
|
||||||
def parse_data(self):
|
def parse_data(self):
|
||||||
if self.useragent:
|
if self.useragent:
|
||||||
self.browser = 'Unknown'
|
self.browser = 'Unknown'
|
||||||
for browser in ('Webkit', 'Safari', 'Chrome', 'Firefox', 'Safari Mobile', 'Opera'):
|
for browser in (
|
||||||
|
'Internet Explorer'
|
||||||
|
'Webkit',
|
||||||
|
'Safari',
|
||||||
|
'Chrome',
|
||||||
|
'Firefox',
|
||||||
|
'Safari Mobile',
|
||||||
|
'Opera',
|
||||||
|
):
|
||||||
if {
|
if {
|
||||||
'Safari Mobile': 'Mobile/',
|
'Safari Mobile': 'Mobile/',
|
||||||
|
'Internet Explorer': 'MSIE',
|
||||||
|
|
||||||
}.get(browser, browser) in self.useragent:
|
}.get(browser, browser) in self.useragent:
|
||||||
self.browser = browser
|
self.browser = browser
|
||||||
|
@ -54,6 +63,10 @@ class SessionData(models.Model):
|
||||||
if {
|
if {
|
||||||
}.get(system, system) in self.useragent:
|
}.get(system, system) in self.useragent:
|
||||||
self.system = system
|
self.system = system
|
||||||
|
if 'Mobile/' in self.useragent and 'Safari' in self.useragent and \
|
||||||
|
('iPhone' in self.useragent or 'iPad' in self.useragent):
|
||||||
|
self.system = 'iOS'
|
||||||
|
|
||||||
if self.ip:
|
if self.ip:
|
||||||
try:
|
try:
|
||||||
g = GeoIP()
|
g = GeoIP()
|
||||||
|
|
Loading…
Reference in a new issue