mirror of https://github.com/jumpserver/jumpserver
asset add
parent
bc232c4f77
commit
792908eb35
|
@ -117,11 +117,14 @@ class Asset(models.Model):
|
|||
os = models.CharField(max_length=128, blank=True, verbose_name=_('OS'))
|
||||
cabinet_no = models.CharField(max_length=32, blank=True, verbose_name=_('Cabinet number'))
|
||||
cabinet_pos = models.IntegerField(null=True, blank=True, verbose_name=_('Cabinet position'))
|
||||
number = models.CharField(max_length=32, blank=True, unique=True, verbose_name=_('Asset number'))
|
||||
status = models.ForeignKey(AssetExtend, null=True, blank=True, related_name="asset_status_extend", verbose_name=_('Asset status'))
|
||||
type = models.ForeignKey(AssetExtend, null=True, blank=True, related_name="asset_type_extend", verbose_name=_('Asset type'))
|
||||
env = models.ForeignKey(AssetExtend, null=True, blank=True, related_name="asset_env_extend", verbose_name=_('Asset environment'))
|
||||
sn = models.CharField(max_length=128, blank=True, unique=True, verbose_name=_('Serial number'))
|
||||
number = models.CharField(max_length=32, blank=True, verbose_name=_('Asset number'))
|
||||
status = models.ForeignKey(AssetExtend, null=True, blank=True,
|
||||
related_name="asset_status_extend", verbose_name=_('Asset status'))
|
||||
type = models.ForeignKey(AssetExtend, null=True, blank=True,
|
||||
related_name="asset_type_extend", verbose_name=_('Asset type'))
|
||||
env = models.ForeignKey(AssetExtend, null=True, blank=True,
|
||||
related_name="asset_env_extend", verbose_name=_('Asset environment'))
|
||||
sn = models.CharField(max_length=128, blank=True, verbose_name=_('Serial number'))
|
||||
created_by = models.CharField(max_length=32, blank=True, verbose_name=_('Created by'))
|
||||
is_active = models.BooleanField(default=True, verbose_name=_('Is active'))
|
||||
date_added = models.DateTimeField(auto_now=True, null=True, verbose_name=_('Date added'))
|
||||
|
|
|
@ -23,7 +23,9 @@ class AssetCreateView(CreateView):
|
|||
success_url = reverse_lazy('assets:asset-list')
|
||||
|
||||
def form_invalid(self, form):
|
||||
print(form.errors)
|
||||
asset = form.save(commit=False)
|
||||
asset.is_active = 1
|
||||
asset.save()
|
||||
return super(AssetCreateView, self).form_invalid(form)
|
||||
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ msgstr "远控卡IP"
|
|||
|
||||
#: assets/models.py:104
|
||||
msgid "Hostname"
|
||||
msgstr "用户名"
|
||||
msgstr "主机名"
|
||||
|
||||
#: assets/models.py:105
|
||||
msgid "Port"
|
||||
|
|
Loading…
Reference in New Issue