22👍
✅
Thanks to Moses link to other SO answers I eventually managed to write a template for additional treatment to a loaddata
command. Here is a snippet which does the trick:
"""
Additional treatment for the loaddata command.
Location example: project/app/management/commands/loaddata.py
"""
from django.core.management.base import BaseCommand, CommandError
from django.core.management.commands import loaddata
class Command(loaddata.Command):
def handle(self, *args, **options):
super(Command, self).handle(*args, **options)
self.stdout.write("Here is a further treatment! :)")
don’t forget to put your application on top in the INSTALLED_APPS configuration
Source:stackexchange.com