Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ';Charss';对象没有属性';获取';_Python_Django - Fatal编程技术网

Python ';Charss';对象没有属性';获取';

Python ';Charss';对象没有属性';获取';,python,django,Python,Django,我是django的新手,我在标题中有这个问题 “Charss”对象没有属性“get” 这是我的密码 class Charss(View): def __init__(self,data): self.data = models.Chars.objects.using('Chars').filter(del_field = 0) def ppop(request,self): sock = socket.socket(socket.AF_INET, socket.SOCK_STRE

我是django的新手,我在标题中有这个问题 “Charss”对象没有属性“get” 这是我的密码

class Charss(View):
def __init__(self,data):
    self.data = models.Chars.objects.using('Chars').filter(del_field = 0)
def ppop(request,self):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    result = sock.connect_ex(('127.0.0.1',1433))
    if result  == 0:
        msg = 'ON'
        return render(request, 'CharsAccount.html',{'msg':msg})
    else:
        msg ='OFF'
        return render(request, 'CharsAccount.html',{'msg':msg})
def CharsAccount(request,self):
    return render(request, 'CharsAccount.html',{'data':self.data})

对不起,我的英语不好

您需要在视图中添加一个名为
get
的方法来处理get请求。我是新来的,但是我可以在哪里添加get?