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 c21130eed9 Docs 202109 (#1067)
* module docstrings

* db schema graph

* dev docs first pass

* dev docs pass 2

* add generated notification to top of generated docs files

* linting

* regen docs

Co-authored-by: Stefan Pratter <stefan@20c.com>
Co-authored-by: Sunshine Buchholz <sunshine@20c.com>
2021-10-15 03:25:38 -05:00

20 lines
503 B
Python

"""
Base class to use for command creation.
"""
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")