1 USER_PASS_REQUEST s1 a:9:{s:7:"USER_ID";s:3:"857";s:6:"STATUS";s:14:"активен";s:7:"MESSAGE";s:77:"Вы запросили ваши регистрационные данные.";s:5:"LOGIN";s:9:"klearased";s:9:"URL_LOGIN";s:9:"klearased";s:9:"CHECKWORD";s:32:"9551c31a0d3d7b93f255d7bdea4b95c6";s:4:"NAME";s:10:"Иван";s:9:"LAST_NAME";s:20:"Иванов";s:5:"EMAIL";s:17:"klearased@mail.ru";} 08.07.2020 09:59:00 08.07.2020 09:59:04 F Y ru
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$this->setFrameMode(true);
?>
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.section.list",
"",
Array(
"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"SECTION_ID" => $arResult["VARIABLES"]["SECTION_ID"],
"SECTION_CODE" => $arResult["VARIABLES"]["SECTION_CODE"],
"DISPLAY_PANEL" => "N",
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
"CACHE_GROUPS" => $arParams["CACHE_GROUPS"],
"SECTION_URL" => $arResult["FOLDER"].$arResult["URL_TEMPLATES"]["section"],
),
$component
);?>
<?
if (CModule::IncludeModule("iblock")) {
$arFilter = array(
"ACTIVE" => "Y",
"GLOBAL_ACTIVE" => "Y",
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
);
if (strlen($arResult["VARIABLES"]["SECTION_CODE"]) > 0) {
$arFilter["=CODE"] = $arResult["VARIABLES"]["SECTION_CODE"];
} elseif ($arResult["VARIABLES"]["SECTION_ID"] > 0) {
$arFilter["ID"] = $arResult["VARIABLES"]["SECTION_ID"];
}
$obCache = new CPHPCache;
if ($obCache->InitCache(36000, serialize($arFilter), "/iblock/catalog")) {
$arCurSection = $obCache->GetVars();
} else {
$arCurSection = array();
$dbRes = CIBlockSection::GetList(array(), $arFilter, false, array("ID"));
$dbRes = new CIBlockResult($dbRes);
if (defined("BX_COMP_MANAGED_CACHE")) {
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache("/iblock/catalog");
if ($arCurSection = $dbRes->GetNext()) {
$CACHE_MANAGER->RegisterTag("iblock_id_" . $arParams["IBLOCK_ID"]);
}
$CACHE_MANAGER->EndTagCache();
} else {
if (!$arCurSection = $dbRes->GetNext())
$arCurSection = array();
}
$obCache->EndDataCache($arCurSection);
}
?>
<? $APPLICATION->IncludeComponent(
"bitrix:catalog.smart.filter",
".default",
Array(
"PRICE_CODE" => $arParams["PRICE_CODE"],
"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"SECTION_ID" => $arCurSection['ID'],
"FILTER_NAME" => 'searchFilter',
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
"CACHE_GROUPS" => $arParams["CACHE_GROUPS"],
"SAVE_IN_SESSION" => "N",
"XML_EXPORT" => "Y",
"SECTION_TITLE" => "NAME",
"SECTION_DESCRIPTION" => "DESCRIPTION",
'HIDE_NOT_AVAILABLE' => $arParams["HIDE_NOT_AVAILABLE"],
"TEMPLATE_THEME" => 'wood'
),
$component,
array('HIDE_ICONS' => 'Y')
); ?>
<?
} ?>
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.section",
"",
Array(
"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"ELEMENT_SORT_FIELD" => $arParams["ELEMENT_SORT_FIELD"],
"ELEMENT_SORT_ORDER" => $arParams["ELEMENT_SORT_ORDER"],
"PROPERTY_CODE" => $arParams["LIST_PROPERTY_CODE"],
"META_KEYWORDS" => $arParams["LIST_META_KEYWORDS"],
"META_DESCRIPTION" => $arParams["LIST_META_DESCRIPTION"],
"BROWSER_TITLE" => $arParams["LIST_BROWSER_TITLE"],
"INCLUDE_SUBSECTIONS" => $arParams["INCLUDE_SUBSECTIONS"],
"BASKET_URL" => $arParams["BASKET_URL"],
"ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"],
"PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"],
"SECTION_ID_VARIABLE" => $arParams["SECTION_ID_VARIABLE"],
"FILTER_NAME" => $arParams["FILTER_NAME"],
"DISPLAY_PANEL" => $arParams["DISPLAY_PANEL"],
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
"CACHE_FILTER" => $arParams["CACHE_FILTER"],
"CACHE_GROUPS" => $arParams["CACHE_GROUPS"],
"SET_TITLE" => $arParams["SET_TITLE"],
"SET_STATUS_404" => $arParams["SET_STATUS_404"],
"DISPLAY_COMPARE" => $arParams["USE_COMPARE"],
"PAGE_ELEMENT_COUNT" => $arParams["PAGE_ELEMENT_COUNT"],
"LINE_ELEMENT_COUNT" => $arParams["LINE_ELEMENT_COUNT"],
"PRICE_CODE" => $arParams["PRICE_CODE"],
"USE_PRICE_COUNT" => $arParams["USE_PRICE_COUNT"],
"SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"],
"PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"],
"DISPLAY_TOP_PAGER" => $arParams["DISPLAY_TOP_PAGER"],
"DISPLAY_BOTTOM_PAGER" => $arParams["DISPLAY_BOTTOM_PAGER"],
"PAGER_TITLE" => $arParams["PAGER_TITLE"],
"PAGER_SHOW_ALWAYS" => $arParams["PAGER_SHOW_ALWAYS"],
"PAGER_TEMPLATE" => $arParams["PAGER_TEMPLATE"],
"PAGER_DESC_NUMBERING" => $arParams["PAGER_DESC_NUMBERING"],
"PAGER_DESC_NUMBERING_CACHE_TIME" => $arParams["PAGER_DESC_NUMBERING_CACHE_TIME"],
"PAGER_SHOW_ALL" => $arParams["PAGER_SHOW_ALL"],
"OFFERS_CART_PROPERTIES" => $arParams["OFFERS_CART_PROPERTIES"],
"OFFERS_FIELD_CODE" => $arParams["LIST_OFFERS_FIELD_CODE"],
"OFFERS_PROPERTY_CODE" => $arParams["LIST_OFFERS_PROPERTY_CODE"],
"OFFERS_SORT_FIELD" => $arParams["OFFERS_SORT_FIELD"],
"OFFERS_SORT_ORDER" => $arParams["OFFERS_SORT_ORDER"],
"OFFERS_LIMIT" => $arParams["LIST_OFFERS_LIMIT"],
"SECTION_ID" => $arResult["VARIABLES"]["SECTION_ID"],
"SECTION_CODE" => $arResult["VARIABLES"]["SECTION_CODE"],
"SECTION_URL" => $arResult["FOLDER"].$arResult["URL_TEMPLATES"]["section"],
"DETAIL_URL" => $arResult["FOLDER"].$arResult["URL_TEMPLATES"]["element"],
),
$component
);
?>
{% if is_admin %}
{% if request.user.is_admin %}
{% if user.is_admin %}
{% if request.user.is_authenticated %}
{% if user.is_authenticated %}
from urllib.parse import urlencode
from django.shortcuts import render
from django.conf import settings
from django.shortcuts import render, render_to_response, get_object_or_404
from django.http import HttpResponse
from django.template import RequestContext, loader
from django.template.context_processors import csrf
from django.db.models import Min
from django.core.paginator import Paginator
from django.db.models import Q
from .models import *
def default_context(request):
csrf_token = dict(csrf(request))
logotype = Logo.objects.last()
context_object = {"c": csrf_token, "logo": logotype}
return context_object
def render_textpage(request, alias, object):
default_context_d = default_context(request)
textpage_data = get_object_or_404(object, alias=alias)
textpage_context = {"data": textpage_data}
context = dict(default_context_d, **textpage_context)
template = loader.get_template("{}.html".format(alias))
return context, template
def search(request):
textpage_data, template = render_textpage(request, "search", TextPage)
params = request.GET.copy()
request_location = params.get("location", None)
request_object_type = params.get("object_type", None)
request_order_type = params.get("order_type", None)
request_location_class = params.get("location_class", "all")
request_square_from = params.get("square_from", None)
request_square_to = params.get("square_to", None)
request_price_from = params.get("price_from", None)
request_price_to = params.get("price_to", None)
request_metro = params.get("metro", None)
request_okrug = params.get("okrug", None)
request_district = params.get("district", None)
request_first_floor_cb = params.get("first_floor", "off")
request_another_entrance_cb = params.get("another_entrance", "off")
request_page = params.get('page', None)
if request_page is None:
request_page = 1
else:
_ = params.pop('page')
object_types = Objecttype.objects.all()
metro_list = Metro.objects.all()
okrug_list = Okrug.objects.all()
district_list = District.objects.all()
class_list = Classtype.objects.all().order_by('position')
queryset = Location.objects.exclude(objects_list=None)\
.exclude(objects_list__size=None)\
.exclude(objects_list__floor=None)\
.exclude(objects_list__price=None)\
.exclude(objects_list__objecttype=None)\
.distinct()
if len(request.GET.dict().keys()) > 0:
if request_location:
queryset = queryset.filter(name__startswith=request_location)
if request_metro:
metro_selected = metro_list.get(pk=request_metro)
queryset = queryset.filter(metro=metro_selected)
if request_okrug:
okrug = okrug_list.get(pk=request_okrug)
district = district_list.filter(okrug=okrug)
queryset = queryset.filter(district__in=district)
if request_location_class and request_location_class != "all":
classtype = class_list.get(pk=request_location_class)
queryset = queryset.filter(classtype=classtype)
if request_object_type and request_object_type != "all":
object_type = object_types.get(pk=request_object_type)
queryset = queryset.filter(
objects_list__objecttype=object_type)
if request_order_type:
queryset = queryset.filter(
objects_list__ordertype=request_order_type)
if request_square_from:
queryset = queryset.filter(
objects_list__size__gte=request_square_from)
if request_square_to:
queryset = queryset.filter(
objects_list__size__lte=request_square_to)
if request_price_from:
queryset = queryset.filter(
objects_list__price__gte=request_price_from)
if request_price_to:
queryset = queryset.filter(
objects_list__price__lte=request_price_to)
for location in queryset:
query_filter = Q()
setattr(location, 'objects_list_refined', location.objects_list.all())
if request_order_type:
query_filter &= Q(ordertype=request_order_type)
if request_price_from:
query_filter &= Q(price__gte=request_price_from)
if request_price_to:
query_filter &= Q(price__lte=request_price_to)
if request_square_from:
query_filter &= Q(size__gte=request_square_from)
if request_square_to:
query_filter &= Q(size__lte=request_square_to)
if query_filter:
location.objects_list_refined = location.objects_list.filter(
query_filter)
all_count = queryset.count()
paginator = Paginator(queryset, 10)
queryset = paginator.get_page(request_page)
textpage_data.update(
{
"class_types": class_list,
"object_types": object_types,
"metro_list": metro_list,
"okrug_list": okrug_list,
"district_list": district_list,
"object_list": queryset,
"num_pages": paginator,
"all_count": all_count,
"params": urlencode(params),
"params_dict": params,
}
)
return HttpResponse(template.render(textpage_data))
def index(request):
textpage_data, template = render_textpage(request, "index", TextPage)
featured_locations = Location.objects.filter(show_on_index=True)\
.exclude(objects_list=None)\
.exclude(objects_list__size=None)\
.exclude(objects_list__floor=None)\
.exclude(objects_list__price=None)\
.exclude(objects_list__objecttype=None)\
.distinct()\
.order_by('?')
featured_objects = Object.objects.filter(show_on_index=True)\
.exclude(size=None)\
.exclude(floor=None)\
.exclude(price=None)\
.exclude(objecttype=None)\
.distinct()\
.order_by('?')
for f_location in featured_locations:
min_price = f_location.objects_list.all().annotate(
Min('price')).values('price')[0]['price']
setattr(f_location, 'min_price', min_price)
textpage_data.update(
{
"object_types": Objecttype.objects.all(),
"metro_list": Metro.objects.all(),
"okrug_list": Okrug.objects.all(),
"district_list": District.objects.all(),
"class_list": Classtype.objects.all().order_by('position'),
"featured_locations": featured_locations,
"featured_objects": featured_objects,
}
)
return HttpResponse(template.render(textpage_data))
def get_object(request, pk):
textpage_data, template = render_textpage(request, "object", TextPage)
current_object = Object.objects.get(pk=pk)
same_location_objects = current_object.location.objects_list.exclude(size=None)\
.exclude(floor=None)\
.exclude(price=None)\
.exclude(objecttype=None)
setattr(current_object.location,
'objects_list_filtered', same_location_objects)
current_object.price_month = current_object.price * current_object.size
current_object.price_year = current_object.price_month * 12
textpage_data.update({"object": current_object})
return HttpResponse(template.render(textpage_data))
def get_location(request, pk):
textpage_data, template = render_textpage(request, "location", TextPage)
location = Location.objects.get(pk=pk)
textpage_data.update({"location": location})
return HttpResponse(template.render(textpage_data))
def create_customer_request(request):
if request.method == "POST":
customer_name = request.POST.get('name', None)
customer_phone = request.POST.get('phone', None)
customer_comment = request.POST.get('comment', '')
customer_page = request.META.get('HTTP_REFERER')
try:
CustomerOrder.objects.create(**{
'name': customer_name,
'phone': customer_phone,
'comment': customer_comment,
'current_page': customer_page
})
return HttpResponse('ok')
except:
return HttpResponse('fail')
else:
return HttpResponse('405 Error')