Fixed ping_google management command to use argparse.
This commit is contained in:
parent
a8521a2c22
commit
03c1a6cb80
|
@ -5,9 +5,8 @@ from django.contrib.sitemaps import ping_google
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Ping Google with an updated sitemap, pass optional url of sitemap"
|
help = "Ping Google with an updated sitemap, pass optional url of sitemap"
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument('sitemap_url', nargs='?', default=None)
|
||||||
|
|
||||||
def execute(self, *args, **options):
|
def execute(self, *args, **options):
|
||||||
if len(args) == 1:
|
ping_google(sitemap_url=options['sitemap_url'])
|
||||||
sitemap_url = args[0]
|
|
||||||
else:
|
|
||||||
sitemap_url = None
|
|
||||||
ping_google(sitemap_url=sitemap_url)
|
|
||||||
|
|
Loading…
Reference in New Issue