forked from 0x2620/pandora
add manage.py command to recheck useragents
This commit is contained in:
parent
ad90b43b4b
commit
1872621d8c
4 changed files with 27 additions and 1 deletions
0
pandora/user/management/__init__.py
Normal file
0
pandora/user/management/__init__.py
Normal file
0
pandora/user/management/commands/__init__.py
Normal file
0
pandora/user/management/commands/__init__.py
Normal file
23
pandora/user/management/commands/update_useragents.py
Normal file
23
pandora/user/management/commands/update_useragents.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from optparse import make_option
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
import monkey_patch.models
|
||||
from ... import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
reparse all useragents. useful after updating python-ox
|
||||
"""
|
||||
help = 'reparse all useragents. useful after updating python-ox'
|
||||
args = ''
|
||||
|
||||
def handle(self, **options):
|
||||
ids = [s['session_key'] for s in models.SessionData.objects.all().values('session_key')]
|
||||
for i in ids:
|
||||
s = models.SessionData.objects.get(pk=i)
|
||||
s.parse_useragent()
|
||||
s.save()
|
||||
Loading…
Add table
Add a link
Reference in a new issue