コード例 #1
0
ファイル: admin.py プロジェクト: johndpope/jazzparser
 def _del(args):
     if len(args) != 1:
         raise CommandError, "del requires a model name as an argument"
     models = model_cls.list_models()
     name_match = re.compile("^%s\d*$" % args[0])
     # Get all models that begin with this string
     matching = [m for m in models if name_match.match(m)]
     if len(matching) > 1:
         print "Multiple numbered models have this name: %s" % ", ".join(group_numerical_suffixes(matching))
         if not boolean_input("Delete all of them?"):
             if args[0] in matching:
                 print "Deleting only exact match"
                 matching = [args[0]]
             else:
                 matching = []
     elif len(matching) == 1:
         if not boolean_input("Delete model %s?" % matching[0]):
             matching = []
     
     if len(matching) == 0:
         print "No models to delete"
     else:
         for name in matching:
             model = _load_model(name)
             print "Deleting %s" % name
             model.delete()
コード例 #2
0
    def _del(args):
        if len(args) != 1:
            raise CommandError, "del requires a model name as an argument"
        models = model_cls.list_models()
        name_match = re.compile("^%s\d*$" % args[0])
        # Get all models that begin with this string
        matching = [m for m in models if name_match.match(m)]
        if len(matching) > 1:
            print "Multiple numbered models have this name: %s" % ", ".join(group_numerical_suffixes(matching))
            if not boolean_input("Delete all of them?"):
                if args[0] in matching:
                    print "Deleting only exact match"
                    matching = [args[0]]
                else:
                    matching = []
        elif len(matching) == 1:
            if not boolean_input("Delete model %s?" % matching[0]):
                matching = []

        if len(matching) == 0:
            print "No models to delete"
        else:
            for name in matching:
                model = _load_model(name)
                print "Deleting %s" % name
                model.delete()
コード例 #3
0
 def _list(args):
     # List the available models for the given model type
     models = model_cls.list_models()
     print "Available models for %s:" % model_cls.MODEL_TYPE
     print ", ".join(list(sorted(group_numerical_suffixes(models))))
コード例 #4
0
ファイル: admin.py プロジェクト: johndpope/jazzparser
 def _list(args):
     # List the available models for the given model type
     models = model_cls.list_models()
     print "Available models for %s:" % model_cls.MODEL_TYPE
     print ", ".join(list(sorted(group_numerical_suffixes(models))))