I'm writing custom django commands under my apps management/commands directory. At the moment I have 6 different files in that directory. Each file has a different command that solves a unique need. However, there are some utilities that are common to all of them. What is the best way to abstract away this common code?
Below is an example:
load_colors
class Command(BaseCommand):
def handle(self, *args, **options)
....code unique to colors
def check_validity(self, color)
....#code common to both shades and colors
load_shades
class Command(BaseCommand):
def handle(self, *args, **options)
....#code unique to shades
def check_validity(self, color)
....#code common to both shades and colors