我想让表单输入用户从下面的字典,但不知道如何使它在django
my_play = dict(
name="may_first_play",
hosts='cisco_firewalls',
become='yes',
become_method='enable',
gather_facts='no',
tasks=[
dict(action=dict(module='asa_command', commands=['show version','show ip'])),
dict(action=dict(module='asa_config', lines=['network-object host 10.1.0.1'])
]
)
我曾制作过这样的模型,但在现场制作任务上令人困惑
class Book(models.Model):
name = models.CharField(max_length=100)
hosts = models.CharField(max_length=100)
become = models.CharField(max_length=100)
become_method = models.CharField(max_length=100)
gather_facts = models.CharField(max_length=100)
class task(Book):`
如果你能帮助我,我将非常感激
请尝试以下代码
您还需要在模型手册中添加“任务”字段
相关问题 更多 >
编程相关推荐