Commit d96ac564 authored by wangyong's avatar wangyong

merge master

parents 77f3a1f1 9fa70f6c
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-21 09:52 # Generated by Django 1.10 on 2016-09-03 14:30
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
...@@ -18,11 +18,11 @@ class Migration(migrations.Migration): ...@@ -18,11 +18,11 @@ class Migration(migrations.Migration):
name='Asset', name='Asset',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ip', models.CharField(blank=True, max_length=32, verbose_name='\u4e3b\u673aIP')), ('ip', models.CharField(blank=True, max_length=32, verbose_name='\u8d44\u4ea7IP')),
('other_ip', models.CharField(blank=True, max_length=255, verbose_name='\u5176\u4ed6IP')), ('other_ip', models.CharField(blank=True, max_length=255, verbose_name='\u5176\u4ed6IP')),
('remote_card_ip', models.CharField(blank=True, max_length=16, verbose_name='\u8fdc\u63a7\u5361IP')), ('remote_card_ip', models.CharField(blank=True, max_length=16, verbose_name='\u8fdc\u63a7\u5361IP')),
('hostname', models.CharField(blank=True, max_length=128, unique=True, verbose_name='\u4e3b\u673a\u540d')), ('hostname', models.CharField(blank=True, max_length=128, unique=True, verbose_name='\u4e3b\u673a\u540d')),
('port', models.IntegerField(blank=True, verbose_name='\u7aef\u53e3\u53f7')), ('port', models.IntegerField(blank=True, verbose_name='\u7aef\u53e3')),
('username', models.CharField(blank=True, max_length=16, verbose_name='\u7ba1\u7406\u7528\u6237\u540d')), ('username', models.CharField(blank=True, max_length=16, verbose_name='\u7ba1\u7406\u7528\u6237\u540d')),
('password', models.CharField(blank=True, max_length=256, verbose_name='\u5bc6\u7801')), ('password', models.CharField(blank=True, max_length=256, verbose_name='\u5bc6\u7801')),
('mac_addr', models.CharField(blank=True, max_length=20, unique=True, verbose_name='MAC\u5730\u5740')), ('mac_addr', models.CharField(blank=True, max_length=20, unique=True, verbose_name='MAC\u5730\u5740')),
...@@ -32,7 +32,7 @@ class Migration(migrations.Migration): ...@@ -32,7 +32,7 @@ class Migration(migrations.Migration):
('disk', models.CharField(blank=True, max_length=1024, verbose_name='\u786c\u76d8')), ('disk', models.CharField(blank=True, max_length=1024, verbose_name='\u786c\u76d8')),
('os', models.CharField(blank=True, max_length=128, verbose_name='\u7cfb\u7edf\u4fe1\u606f')), ('os', models.CharField(blank=True, max_length=128, verbose_name='\u7cfb\u7edf\u4fe1\u606f')),
('cabinet_no', models.CharField(blank=True, max_length=32, verbose_name='\u673a\u67dc\u53f7')), ('cabinet_no', models.CharField(blank=True, max_length=32, verbose_name='\u673a\u67dc\u53f7')),
('cabinet_pos', models.IntegerField(blank=True, verbose_name='\u673a\u5668\u4f4d\u7f6e')), ('cabinet_pos', models.IntegerField(blank=True, null=True, verbose_name='\u8d44\u4ea7\u4f4d\u7f6e')),
('number', models.CharField(blank=True, max_length=32, unique=True, verbose_name='\u8d44\u4ea7\u7f16\u53f7')), ('number', models.CharField(blank=True, max_length=32, unique=True, verbose_name='\u8d44\u4ea7\u7f16\u53f7')),
('sn', models.CharField(blank=True, max_length=128, unique=True, verbose_name='SN\u7f16\u53f7')), ('sn', models.CharField(blank=True, max_length=128, unique=True, verbose_name='SN\u7f16\u53f7')),
('created_by', models.CharField(blank=True, max_length=32, verbose_name='\u521b\u5efa\u8005')), ('created_by', models.CharField(blank=True, max_length=32, verbose_name='\u521b\u5efa\u8005')),
...@@ -101,11 +101,11 @@ class Migration(migrations.Migration): ...@@ -101,11 +101,11 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='asset', model_name='asset',
name='status', name='status',
field=models.ManyToManyField(blank=True, related_name='asset_status_extend', to='assets.AssetExtend', verbose_name='\u673a\u5668\u72b6\u6001'), field=models.ManyToManyField(blank=True, related_name='asset_status_extend', to='assets.AssetExtend', verbose_name='\u8d44\u4ea7\u72b6\u6001'),
), ),
migrations.AddField( migrations.AddField(
model_name='asset', model_name='asset',
name='type', name='type',
field=models.ManyToManyField(blank=True, related_name='asset_type_extend', to='assets.AssetExtend', verbose_name='\u673a\u5668\u7c7b\u578b'), field=models.ManyToManyField(blank=True, related_name='asset_type_extend', to='assets.AssetExtend', verbose_name='\u8d44\u4ea7\u7c7b\u578b'),
), ),
] ]
...@@ -42,11 +42,11 @@ class AssetExtend(models.Model): ...@@ -42,11 +42,11 @@ class AssetExtend(models.Model):
class Asset(models.Model): class Asset(models.Model):
ip = models.CharField(max_length=32, blank=True, verbose_name="主机IP") ip = models.CharField(max_length=32, blank=True, verbose_name="资产IP")
other_ip = models.CharField(max_length=255, blank=True, verbose_name="其他IP") other_ip = models.CharField(max_length=255, blank=True, verbose_name="其他IP")
remote_card_ip = models.CharField(max_length=16, blank=True, verbose_name=u'远控卡IP') remote_card_ip = models.CharField(max_length=16, blank=True, verbose_name=u'远控卡IP')
hostname = models.CharField(max_length=128, unique=True, blank=True, verbose_name=u"主机名") hostname = models.CharField(max_length=128, unique=True, blank=True, verbose_name=u"主机名")
port = models.IntegerField(blank=True, verbose_name=u"端口") port = models.IntegerField(blank=True, verbose_name=u"端口")
group = models.ManyToManyField(AssetGroup, blank=True, verbose_name=u"所属主机组") group = models.ManyToManyField(AssetGroup, blank=True, verbose_name=u"所属主机组")
username = models.CharField(max_length=16, blank=True, verbose_name=u"管理用户名") username = models.CharField(max_length=16, blank=True, verbose_name=u"管理用户名")
password = models.CharField(max_length=256, blank=True, verbose_name=u"密码") password = models.CharField(max_length=256, blank=True, verbose_name=u"密码")
...@@ -58,12 +58,12 @@ class Asset(models.Model): ...@@ -58,12 +58,12 @@ class Asset(models.Model):
disk = models.CharField(max_length=1024, blank=True, verbose_name=u'硬盘') disk = models.CharField(max_length=1024, blank=True, verbose_name=u'硬盘')
os = models.CharField(max_length=128, blank=True, verbose_name=u'系统信息') os = models.CharField(max_length=128, blank=True, verbose_name=u'系统信息')
cabinet_no = models.CharField(max_length=32, blank=True, verbose_name=u'机柜号') cabinet_no = models.CharField(max_length=32, blank=True, verbose_name=u'机柜号')
cabinet_pos = models.IntegerField(max_length=4, null=True, blank=True, verbose_name=u'机器位置') cabinet_pos = models.IntegerField(null=True, blank=True, verbose_name=u'资产位置')
number = models.CharField(max_length=32, blank=True, unique=True, verbose_name=u'资产编号') number = models.CharField(max_length=32, blank=True, unique=True, verbose_name=u'资产编号')
status = models.ManyToManyField(AssetExtend, blank=True, status = models.ManyToManyField(AssetExtend, blank=True,
related_name="asset_status_extend", verbose_name="机器状态") related_name="asset_status_extend", verbose_name="资产状态")
type = models.ManyToManyField(AssetExtend, blank=True, type = models.ManyToManyField(AssetExtend, blank=True,
related_name="asset_type_extend", verbose_name="机器类型") related_name="asset_type_extend", verbose_name="资产类型")
env = models.ManyToManyField(AssetExtend, blank=True, env = models.ManyToManyField(AssetExtend, blank=True,
related_name="asset_env_extend", verbose_name="所属主机组环境") related_name="asset_env_extend", verbose_name="所属主机组环境")
sn = models.CharField(max_length=128, blank=True, unique=True, verbose_name=u"SN编号") sn = models.CharField(max_length=128, blank=True, unique=True, verbose_name=u"SN编号")
......
This diff is collapsed.
...@@ -32,8 +32,4 @@ def pagination_range(total_page, current_num=1, display=5): ...@@ -32,8 +32,4 @@ def pagination_range(total_page, current_num=1, display=5):
start = current_num - display/2 if current_num > display/2 else 1 start = current_num - display/2 if current_num > display/2 else 1
end = start + display if start + display <= total_page else total_page + 1 end = start + display if start + display <= total_page else total_page + 1
return range(start, end) return range(start, end)
\ No newline at end of file
...@@ -21,4 +21,3 @@ def get_object_or_none(model, **kwargs): ...@@ -21,4 +21,3 @@ def get_object_or_none(model, **kwargs):
except model.DoesNotExist: except model.DoesNotExist:
obj = None obj = None
return obj return obj
...@@ -29,5 +29,3 @@ class UserGroupSerializer(serializers.ModelSerializer): ...@@ -29,5 +29,3 @@ class UserGroupSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = UserGroup model = UserGroup
fields = '__all__' fields = '__all__'
...@@ -36,6 +36,3 @@ def user_avatar_url(user): ...@@ -36,6 +36,3 @@ def user_avatar_url(user):
default_avatar = default_avatar_list[len(user.username) % len(default_avatar_list)] default_avatar = default_avatar_list[len(user.username) % len(default_avatar_list)]
return os.path.join(settings.MEDIA_URL, 'avatar', 'default', default_avatar) return os.path.join(settings.MEDIA_URL, 'avatar', 'default', default_avatar)
return 'https://www.gravatar.com/avatar/c6812ab450230979465d7bf288eadce2a?s=120&d=identicon' return 'https://www.gravatar.com/avatar/c6812ab450230979465d7bf288eadce2a?s=120&d=identicon'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment