1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/peeringdb_server/management/commands/pdb_base_command.py
Matt Griswold 04f1928b3c Updates 2.23 (#843)
* pipenv lock and pyupgrade

* pyupgrade, black format, add docs

* update for py3.7
2020-09-29 20:13:38 -05:00

16 lines
454 B
Python

from django.core.management.base import BaseCommand
class PeeringDBBaseCommand(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("--commit", action="store_true", help="Commit the changes.")
def log(self, msg):
if self.commit:
self.stdout.write(msg)
else:
self.stdout.write(f"[pretend] {msg}")
def handle(self, *args, **options):
self.commit = options.get("commit")