for line in data:
делай цикл вручную, например так:while True:
line = data.readline()
if not line:
break
... # тут выполняем дальнейшие операции
from django.core.paginator import Paginator
from django.shortcuts import render
class Panel_Promocodes(IsWorkerMixin, View):
def get(self, request: HttpRequest) -> HttpResponse:
data = request.GET
page_index: int = int(data.get('page_index', 1))
data_limit: int = int(data.get('data_limit', 5))
promos = Promo.objects.filter(user=request.user).order_by('-id')
paginator = Paginator(promos, data_limit)
codes_page = paginator.get_page(page_index)
context = {
'codes_count': promos.count(),
'codes': codes_page,
'page_index': page_index,
'data_limit': data_limit,
'pages_count': paginator.num_pages
}
return render(request, 'panel/promocodes.html', context)
<?php
$id = $_COOKIE["auth_id"];
require("../connect.php");
$query_lobby = mysqli_query($connection, "SELECT * FROM lobby WHERE id_taker='$id' and status = 1");
while ($row_send = mysqli_fetch_assoc($query_lobby)){
$query = "SELECT * FROM users WHERE id='" . $row_send['id_sender'] . "'";
$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
$row = $result->fetch_assoc();
$sender_name = $row['username'];
$sender_id = $row['id'];
$sender_avatar = $row['avatar'];
print_r("$sender_id");
?>
<div class="accountFriendlist" style="justify-content:center; display:flex;">
<div class="friendsList" style="width:500px;">
<div class="friend">
<div class="friendInfo" style="cursor:auto;">
<?php
if (isset($row['avatar'])) { ?>
<div class="avatar" style="width:75px;height:75px"><img style="width: 75px;
height: 75px; border-radius: 50%;" src="/avatars/'.$sender_avatar.'" alt=""></div>
<?php
} else { ?>
<div class="avatar"><?php
printf($sender_name[0]) ?></div>
<?php } ?>
<div class="nickname">
<?= $sender_name?> id <?= $sender_id?>
</div>
<div class="inviteDate" style="padding-left:10px;">
<?= $row_send['date']?>
</div>
</div>
<div class="actions" style="cursor: pointer;">
<div class="acceptLobby"><a style="font-weight: 600;
font-size: 18px;
color: #4994e1;
cursor: pointer;
text-align: center;" onclick="acceptLobby(<?= $sender_id?>, <?= $id?>);">
<i class="fas fa-plus"></i>Join</a></div>
<div class="cancelLobby">
<a style="
font-weight: 500;
font-size: 12px;
opacity: .5;
letter-spacing: 1.5px;
text-transform: uppercase;
color: #4994e1;
cursor: pointer;
text-align: center;" onclick="cancelLobby(<?= $sender_id?>, <?= $id?>);">Cancel</a></div>
</div>
</div>
</div>
</div>
<?php } ?>