Source

django-helptext / helptext / management / commands / helptext_save.py

Full commit
from django.core.management.base import NoArgsCommand
from helptext.models import FieldHelp

class Command(NoArgsCommand):
    help = (
        'Loads the help text from the database and prints out a string which '
        'can be saved to a configuration file. Help text will then be the '
        'value from the database if there is one, followed by the value from '
        'configuration if there is on, finally followed by the programmed '
        'help text.\n\nFor example, you could call\n\n'
        './manage.py helptext_save > helptext_configuration.py\n\nThen in '
        'settings.py you need to point HELPTEXT_CONFIGURATION to the python '
        'path of your configruation file by doing something like this:\n\n'
        'HELPTEXT_CONFIGURATION = \'my_program.helptext_configuration\'')

    def handle_noargs(self, **options):
        to_save = {}
        for help in FieldHelp.objects.all():
            if help.help_text:
                to_save[help.lookup_key()] = help.help_text
        print "helptext_configuration = %s" % str(to_save)