请教一下,django实现查看密码功能 #1357
Unanswered
unknowissue
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
各位童鞋,
请教一下,我想在实例管理-账号管理-中实现查看已录入的账号密码功能,
我看了下,
# 获取已录入用户
cnf_users = dict()
for user in InstanceAccount.objects.filter(instance=instance).values('id', 'user', 'host', 'remark'):
user['saved'] = True
cnf_users[f"
{user['user']}
@{user['host']}
"] = user使用了
class InstanceAccount(models.Model):
"""
实例账号列表
"""
instance = models.ForeignKey(Instance, on_delete=models.CASCADE)
user = fields.EncryptedCharField(verbose_name='账号', max_length=128)
host = models.CharField(verbose_name='主机', max_length=64)
password = fields.EncryptedCharField(verbose_name='密码', max_length=128, default='', blank=True)
remark = models.CharField('备注', max_length=255)
sys_time = models.DateTimeField('系统修改时间', auto_now=True)
但是没懂咋获取,还是我需要自己来个新方法读数据库?
Beta Was this translation helpful? Give feedback.
All reactions