поправил

This commit is contained in:
KessPen
2024-05-15 20:07:09 +07:00
parent 4361f75acb
commit 63f73adcb2

View File

@@ -2,7 +2,6 @@ import hashlib
from django.http import JsonResponse, HttpRequest, HttpResponse
from django.shortcuts import render
from django.forms.models import model_to_dict
from SusMarketBackend.models import Category, Product, Review, User
@@ -56,7 +55,7 @@ def user(request: HttpRequest):
if request.GET:
login = request.GET["login"]
password = request.GET["password"]
userObj = {"user": model_to_dict(User.objects.filter(login=login, password=hashlib.md5(str(password).encode('utf-8')).hexdigest()).first())}
userObj = {"user": list(User.objects.filter(login=login, password=hashlib.md5(str(password).encode('utf-8')).hexdigest()).first())}
return JsonResponse(userObj)
return HttpResponse('{error: "You doing not right"}')