def handle(self, *args, **options):
        if len(args) > 0:
            m = Metabolism(args[0])
            j = JsonModel.from_model(m)
        else:
            return
        
        try:
            dt = DesignTemplate.objects.get(name=options["name"])
            print("Updating existing template " + dt.name)
        except ObjectDoesNotExist:
            dt = DesignTemplate(name=options["name"])
            print("Creating new template " + dt.name)

        dt.description = options["description"]
        dt.filename = os.path.basename(args[0])
        dt.content = j.to_json()
        dt.save()
    def handle(self, *args, **options):
        if len(args) > 0:
            m = Metabolism(args[0])
            j = JsonModel.from_model(m)
        else:
            return
        
        try:
            dt = DesignTemplate.objects.get(name=options["name"])
            print("Updating existing template " + dt.name)
        except ObjectDoesNotExist:
            dt = DesignTemplate(name=options["name"])
            print("Creating new template " + dt.name)

        dt.description = options["description"]
        dt.filename = os.path.basename(args[0])
        dt.content = j.to_json()
        dt.save()
Пример #3
0
    def setUp(self):
        self.doLogin()
        self.user.profile.assign_perm(ACCESS_PERM)

        # Add templates
        m = Metabolism(MODEL_FILE)
        j = JsonModel.from_model(m)
        dt = DesignTemplate(name="Test")
        dt.description = "Test"
        dt.filename = "ToyModel.txt"
        dt.content = j.to_json()
        dt.save()
        self.pk = dt.pk

        m = Metabolism(MODEL_FILE2)
        j = JsonModel.from_model(m)
        dt = DesignTemplate(name="Test")
        dt.description = "Test"
        dt.filename = "iSyn.txt"
        dt.content = j.to_json()
        dt.save()
Пример #4
0
    def setUp(self):
        self.doLogin()
        self.user.profile.assign_perm(ACCESS_PERM)

        # Add templates
        m = Metabolism(MODEL_FILE)
        j = JsonModel.from_model(m)
        dt = DesignTemplate(name="Test")
        dt.description = "Test"
        dt.filename = "ToyModel.txt"
        dt.content = j.to_json()
        dt.save()
        self.pk = dt.pk

        m = Metabolism(MODEL_FILE2)
        j = JsonModel.from_model(m)
        dt = DesignTemplate(name="Test")
        dt.description = "Test"
        dt.filename = "iSyn.txt"
        dt.content = j.to_json()
        dt.save()