Skip to content

Commit

Permalink
using opt parse on older django
Browse files Browse the repository at this point in the history
  • Loading branch information
John Furr committed Sep 20, 2016
1 parent d98f901 commit 0b3d01c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions mongolog/management/commands/analog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#!/usr/bin/env python
from __future__ import print_function
import logging
import django

import pymongo
pymongo_version = int(pymongo.version.split(".")[0])
Expand All @@ -15,12 +16,23 @@


class Command(BaseCommand):
if django.VERSION[1] <= 7:
from optparse import make_option
option_list = BaseCommand.option_list + (
make_option('--delete',
action='store_true',
dest='delete',
default=False,
help='Delete poll instead of closing it'),
)


def add_arguments(self, parser):
parser.add_argument(
'-l', '--limit', default=10, type=int, action='store', dest='limit',
help='Limit Results',
)
if django.VERSION[1] >= 7:
parser.add_argument(
'-l', '--limit', default=10, type=int, action='store', dest='limit',
help='Limit Results',
)

def handle(self, *args, **options):
handler = get_mongolog_handler()
Expand Down

0 comments on commit 0b3d01c

Please sign in to comment.