fix of for loop
This commit is contained in:
parent
2b842a7238
commit
23bfee6aa1
@ -198,13 +198,14 @@ def photos(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def upload_files(request):
|
def upload_files(request):
|
||||||
for name, file request.FILES.items():
|
for name, file in request.FILES.items():
|
||||||
print(name)
|
print(name)
|
||||||
rand = random.randint(9999999999999)
|
rand = random.randint(9999999999999)
|
||||||
random_name = f'photos/uploads/{rand}.jpg'
|
random_name = f'photos/uploads/{rand}.jpg'
|
||||||
with open(random_name, "wb+") as destination:
|
with open(random_name, "wb+") as destination:
|
||||||
for chunk in f.chunks():
|
for chunk in f.chunks():
|
||||||
destination.write(chunk)
|
destination.write(chunk)
|
||||||
|
return HttpResponse('{"success":"Úspěšně nahráno! Počkejte až dojde ke schválení nahraných souborů.}', content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
@staff_member_required
|
@staff_member_required
|
||||||
|
Loading…
x
Reference in New Issue
Block a user