未完待续
1.apps/assets/models/assets.py
添加字段:
zabbix_group_id = models.IntegerField(null=True,blank=True,verbose_name=_('Zabbix Group Id'))
null=True 数据库里的字段值可为空
blank=True 表单验证可为空
2.apps/i18n/zh/LC_MESSAGES/django.po
#: assets/models/asset.py:128
msgid "Zabbix Group Id"
msgstr "Zabbix 主机组 ID"
python3 manage.py compilemessages
/var/www/jumpserver/jms restart all -d
3.cd /var/www/jumpserver(进入env环境: py3)
python3 manage.py makemigrations assets
填写默认值
python3 manage.py migrate assets
4.DEBUG
logger.debug("asset create view get"+str(form.__dict__))
5.添加左节点
5.1 ../apps/templates/_nav.html 添加
<li id='zabbix_host'>
<a>
<i class="fa fa-history" style="width:14px"></i>
<span class="nav-label">监控管理</span>
<span class="fa arrow"></span>
</a>
<ul class="nav nav-second-level">
<li id="db"><a href="{% url 'zabbix_host:db-list' %}">数据库列表</a></li>
</ul>
</li>
5.2
网友评论