Python
- 1 ответ
- 0 вопросов
1
Вклад в тег
response.encoding
response.encoding = 'utf-8-sig'
import json
import requests
response = requests.get('https://кто-звонит.рф/9853691815/')
response.encoding = 'utf-8-sig'
print(response.text)
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)