jumpserver/apps/assets/models/asset/database.py

25 lines
555 B
Python
Raw Normal View History

2022-04-02 10:35:46 +00:00
from django.db import models
2022-04-26 13:30:01 +00:00
from django.utils.translation import gettext_lazy as _
2022-04-02 10:35:46 +00:00
from .common import Asset
class Database(Asset):
2022-04-26 13:30:01 +00:00
db_name = models.CharField(max_length=1024, verbose_name=_("Database"), blank=True)
2022-04-28 04:47:39 +00:00
def __str__(self):
2022-09-21 03:17:14 +00:00
return '{}({}://{}/{})'.format(self.name, self.type, self.address, self.db_name)
@property
def ip(self):
return self.address
2022-04-28 04:47:39 +00:00
2022-10-19 10:56:46 +00:00
@property
2022-11-01 03:52:51 +00:00
def specific(self):
2022-10-19 10:56:46 +00:00
return {
'db_name': self.db_name,
}
2022-04-26 13:30:01 +00:00
class Meta:
verbose_name = _("Database")