예제 #1
0
파일: gen_admin.py 프로젝트: LiuDeng/uml2dj
def gen_admin(options, logger, args):
    """
    generate django admin from UML xml
       usage: gen_models <file_name>"""

    if len(args) != 1 or not os.path.isfile(args[0]):
        print "Please specify one correct file for parse"

    models = parse(options, logger, args[0])

    for model in models:
        print model.gen_admin()
예제 #2
0
def gen_choices(options, logger, args):
    """
    generate django choices from UML xml
       usage: gen_choices <file_name>"""

    if len(args) != 1 or not os.path.isfile(args[0]):
        print "Please specify one correct file for parse"

    models = parse(options, logger, args[0])
    # print choices
    for model in models:
        for field in model.fields:
            if field.choices:
                print re.sub(r':', ' =', field.choices)