Answer the question
In order to leave comments, you need to log in
I get the error 'WSGIRequest' object has no attribute 'request', how can I fix this?
from django.shortcuts import render, HttpResponseRedirect
from django.contrib.auth import authenticate, login
class AccountViews:
def __init__(self, request=None, user=None, username=None, password=None):
self.request = request
self.username = username
self.password = password
self.user = user
def account(self):
return HttpResponseRedirect("/")
def login(self):
self.username = self.request.POST['username']
self.password = self.request.POST['password']
self.user = authenticate(self.request, username=self.username, password=self.password)
if self.user is not None:
login(self.request, self.user)
return HttpResponseRedirect("/")
def register(self):
pass
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question