# Path: cachemanage/models.py
# class Redislist(models.Model):
#     """
#     asset modle
#         create_time = models.DateTime(default=datetime.now)
#     """
#     redis_host=models.CharField(max_length=100, blank=True, null=True, verbose_name=u"redis_host")
#     redis_role = models.CharField(max_length=20, blank=True, null=True, verbose_name=u"redis_role")
# 
# 
#     def __unicode__(self):
#         return self.redis_host


from django.shortcuts import render
from juser.user_api import *
from cachemanage.models import Redislist
import os
import MySQLdb as mysql
import json
# coding: utf-8



db = mysql.connect(user="root", passwd="", \
        db="jumpserver", charset="utf8")
db.autocommit(True)
c = db.cursor()


# Create your views here.


redis_path='/root/jumpserver-master/redis-3.2.8/src/redis-cli -c '

notallowcmds=["del","flushall","flushdb","set"]

# @require_role(role='user')
def cachemanage_redislistjson(request):
    redis_list=[{"id": '请选择数据库', "text": "请选择数据库", "icon": "database.ico", "selected": "true"}]
    defend_attack(request)

# Path: cachemanage/models.py
# class Redislist(models.Model):
#     """
#     asset modle
#         create_time = models.DateTime(default=datetime.now)
#     """
#     redis_host=models.CharField(max_length=100, blank=True, null=True, verbose_name=u"redis_host")
#     redis_role = models.CharField(max_length=20, blank=True, null=True, verbose_name=u"redis_role")
# 
# 
#     def __unicode__(self):
#         return self.redis_host


# Path: cachemanage/views.py
from django.shortcuts import render
from juser.user_api import *
from cachemanage.models import Redislist
import os
import MySQLdb as mysql
import json

# coding: utf-8



db = mysql.connect(user="root", passwd="", \
        db="jumpserver", charset="utf8")
db.autocommit(True)
c = db.cursor()


# Create your views here.


redis_path='/root/jumpserver-master/redis-3.2.8/src/redis-cli -c '

notallowcmds=["del","flushall","flushdb","set"]

# @require_role(role='user')
def cachemanage_redislistjson(request):
    redis_list=[{"id": '请选择数据库', "text": "请选择数据库", "icon": "database.ico", "selected": "true"}]
    defend_attack(request)

    mylist=Redislist.objects.filter(redis_role="master")