django-helptext / helptext / management / commands /

Full commit
from 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'
        './ helptext_save >\n\nThen in '
        ' 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)