From 08e108152c3ca485969801dd5cf9f206dc9635e5 Mon Sep 17 00:00:00 2001 From: booblegum Date: Fri, 11 Nov 2016 00:16:34 +0300 Subject: [PATCH 1/2] =?UTF-8?q?PR-20=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Переработана логика работы фильтра проектов. Доработан дизайн фильтра. --- assets/css/main.css | 6 +- assets/lib/proekton-components/css/other.css | 59 +++-- .../proekton-components/css/select-box.css | 57 ++++- assets/lib/proekton-components/img/rect01.png | Bin 2618 -> 2564 bytes assets/lib/proekton-components/img/rect02.png | Bin 2625 -> 2557 bytes .../lib/proekton-components/js/SelectBox.js | 3 +- .../js/SelectedContainer.js | 4 +- .../proekton-components/js/SimpleSelect.js | 3 +- assets/projects-filter.js | 45 ++++ .../partials/inc-projects-filter.html | 119 ++++++++++ .../partials/inc-projects-results.html | 72 ++++++ .../partials/inc-projects-sort_by.html | 13 ++ projects/templates/project_filter.html | 217 +----------------- projects/views.py | 111 +++++---- templates/partials/ajax_pagination.html | 65 ++++++ 15 files changed, 481 insertions(+), 293 deletions(-) create mode 100644 assets/projects-filter.js create mode 100644 projects/templates/partials/inc-projects-filter.html create mode 100644 projects/templates/partials/inc-projects-results.html create mode 100644 projects/templates/partials/inc-projects-sort_by.html create mode 100644 templates/partials/ajax_pagination.html diff --git a/assets/css/main.css b/assets/css/main.css index 595b0ac..62037d6 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -1329,10 +1329,10 @@ footer:after { } .titleResF1, div p.titleResF1 { - font-size: 15px; + font-size: 14pt; font-family: 'Arial-MT-Regular', sans-serif; - font-weight: bold; - color: #2c2c2c; + /*font-weight: bold;*/ + color: #000000; float: left; } diff --git a/assets/lib/proekton-components/css/other.css b/assets/lib/proekton-components/css/other.css index 375262d..21206b3 100644 --- a/assets/lib/proekton-components/css/other.css +++ b/assets/lib/proekton-components/css/other.css @@ -10,8 +10,8 @@ label { } .selected-container .selected-element { - display: inline-block; - padding: 5px 25px 5px 10px; + /*display: inline-block;*/ + padding: 5px 35px 5px 10px; margin-top: 8px; min-height: 45px; background-color: #e3e3e3; @@ -21,35 +21,45 @@ label { -webkit-border-radius: 10px; /* Safari 4 */ border-radius: 10px; /* IE 9, Safari 5, Chrome */ } +.horizontal .selected-element{ + display: inline-block; +} -.selected-element .header{ - font-size: 9pt; - color: #979494; +.selected-element .header,.name{ white-space: nowrap; text-overflow: ellipsis; overflow: hidden; - word-wrap: break-word; + width: 100%; +} + +.selected-element .header{ + font-size: 7pt; + color: #676363; + /*white-space: nowrap;*/ + /*text-overflow: ellipsis;*/ + /*overflow: hidden;*/ + /*word-wrap: break-word;*/ + /*width: 100%;*/ } .selected-element .name { - font-size: 14pt; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: middle; - width: 100%; + font-size: 11pt; + /*white-space: nowrap;*/ + /*text-overflow: ellipsis;*/ + /*overflow: hidden;*/ + /*width: 100%;*/ } .selected-element .icon-remove{ background-image: url('../img/cross01.png'); - background-size: 24px 24px; + background-size: 20px 20px; /*display: inline-block;*/ position: absolute; right: 5px; top: 15px; - width: 16px; - height: 16px; + width: 20px; + height: 20px; cursor: pointer; margin-left: -20px; } @@ -66,7 +76,8 @@ label { } .separator { - margin: 20px 0; + margin-top: 35px; + margin-bottom: 5px; } .max-width { @@ -83,26 +94,26 @@ label { } .custom-check { background: url("../img/rect01.png") no-repeat center; - background-size: 200px 40px; - width: 200px; - height: 40px; + background-size: 210px 51px; + width: 210px; + height: 51px; cursor: pointer; } .custom-check.checked { background: url("../img/rect02.png") no-repeat center; - background-size: 200px 40px; - width: 200px; - height: 40px; + background-size: 210px 51px; + width: 210px; + height: 51px; } #page-preloader { - position: fixed; + position: absolute; left: 0; top: 0; right: 0; bottom: 0; - background: #000; + background: #090909; z-index: 100500; } diff --git a/assets/lib/proekton-components/css/select-box.css b/assets/lib/proekton-components/css/select-box.css index 15d067e..54eeb1a 100644 --- a/assets/lib/proekton-components/css/select-box.css +++ b/assets/lib/proekton-components/css/select-box.css @@ -1,10 +1,38 @@ +body { + font-size: 11pt; + font-family: Arial-MT-Regular, Arial, Sans-Serif; +} + +input[type="checkbox"] + span, input[type="checkbox"]:checked + span { + all: initial; + font-size: 9pt; + color: #494546; + cursor: pointer; +} + +.noselect { + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Chrome/Safari/Opera */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; + /* Non-prefixed version, currently + not supported by any browser */ +} + +/*input[type="checkbox"]:checked + span {*/ +/*all: initial;*/ +/*font-size: 9pt;*/ +/*color: #494546;*/ +/*}*/ + .select-box-container { display: block; /*margin-top: 40px;*/ /*min-width: 200px;*/ } -.select-box-header{ +.select-box-header { font-size: 14pt; white-space: nowrap; word-wrap: break-word; @@ -12,7 +40,7 @@ /*top:10px;*/ } -.select-box-header .header{ +.select-box-header .header { display: inline-block; color: black; text-overflow: ellipsis; @@ -23,11 +51,15 @@ } /*.select-box-header i {*/ - /*position: relative;*/ - /*top: -5px;*/ +/*position: relative;*/ +/*top: -5px;*/ /*}*/ -.select-box-header .fa:hover{ +.select-box-header .fa { + color: #565656; +} + +.select-box-header .fa:hover { cursor: pointer; } @@ -70,17 +102,21 @@ padding: 2px 10px; border-bottom: 1px solid #afb2b6; list-style: none; + font-size: 9pt; + color: #494546; } .select-box-results label, .select-box-options label, .select-box-results li, .select-box-options li { cursor: pointer; + display: inline-block; width: 100%; } .select-box-results li:hover, .select-box-options li:hover { background-color: #dcdcdc; border-left: 2px solid red; + color: #0b0b0b; } .select-box-search { @@ -88,7 +124,7 @@ } input.select-box-search { - height: 40px; + height: 51px; width: 100%; border: 1px solid #cccccc; outline: none; @@ -157,15 +193,16 @@ input.select-box-search { .editable-container { display: block; float: left; - /*max-width: 400px;*/ background-color: #e5e5e5; - min-height: 40px; + color: #585858; + font-size: 9pt; padding: 5px 10px; - /*min-width: 40px;*/ + height: 51px; + margin-left: 8px; position: relative; left: -30px; } -.vertical-child{ +.vertical-child { margin-top: 30px; } \ No newline at end of file diff --git a/assets/lib/proekton-components/img/rect01.png b/assets/lib/proekton-components/img/rect01.png index 841209e9e760fdcc5ea2759997a9d51fd3da476c..aa314cee196eef72d3753a75a71ab7da44793a40 100644 GIT binary patch delta 2480 zcmV;h2~YOA6oeFzZhwJEL_t(|obBCBOcduI2k`H_umkMQ2&{mA1))N;MrsXhf-$Cv z@g*Yk;(-#|gN8Q7OKUVVZM~Wp>qSfIu@{DtgOG7kSqZleKy6g+= z3p=y(KeP~7clLdmUFP>Wt@}JP^K-NNW#)P2g&7_m@d6AFLVpO!I928WhX3fJ&4nDt z>0J#WWCc+a1vcAQfCm7UWx=wn-Zc?IRuENH0RWUNgpjPFkRgO*6%F_%C>#!BW@ZLn zuNT2!5V9;U><$uRU>F8G&%%ZqDaFG380XPLseBcolZC$4#={scR567!C(-x zv$L3kkOzh3hZ_}g27qh3x5ljv7-D@Qc?o5*{pXNx(bCt@cDdtmyuH_WFo|xNt!=Df@mu(Ej9d@gwYQh zBT>jih&5v(NzyV_lAm~0Z9_Z}s#G^-#;`SRF8j5?K(#ex2@%Zs$06=$lH>#?tGE$?KltMzyGe;FL?JZrdnIUmX)FE-Mb}iuJ6Bx?~gy?ZmX!d8RgfnWBS`~ z;qUKHy4L?ad4htiTa#XnkX+Q!(SeSRj(;WZJ$?EVhYlS|X!&c`t|1%_qoJVzqobqf z@9)RaqeruPvZ?NeOMG1&Off>h^vNdx0Aa@tFi~!8=pPz_>hr<$>8IeUtKVy9R;|ih zv4rSke$OKvs;Z)|uMYrl;=~D@K7AU`pFhXLhYzuR`}VZguSNHeDQay+>G|_<`+rG4 z{1Em1fBrj^62JQn=C8iWba{m2g!wDG)4610cz75S6BDSeuEy4_ThY?eg08ME^!D~< zHDqXZiI6-nH#Y|$y^BwKd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$PiKnVpCH90F6U=e&I}l{r!-GK^R_s8C*-t{PX6{P5?lluP^T!mE?6!W@KapeHn@y z9UaZOjr;fSXWYilojVtFe-lzsBnk1v-80w>Lq;<3Cq84Q#IKk+rv3XNSbwdE+`Ws) z;2?Bcw&Yi98hM4x@bEB(hllejU~q5{gM)*L%WG3?Gz1NU0pbO^l0`1v)n-I!i5WnL?UoHomsa< z2w8qh3Yps4T7T5m)@E&IGMTVp!-llWoK9y!f}!O<*I^K{QZNPsG(4YmD$P_HyB!*v ztw>cZjp~O>gph?SCr-d};zZ8tHM-qJs3t#j6*eKHs3>FzAw@+YLkKA<3K>F3QBlZ{ zByyJf_7IXQ3K^0lp1A23$u1U?)GnbcP{@!Zk|fcunSVu+Bnp|uppZ$y6zHO`awW?$ zL@}s#8D$|52&8?!()XcM6f!BaTCLh8sBUI@TI~`_o-E7oE8NSS_Mv1HGAZ;q4&z>l z0s%ilAyMrzN}A6nK$4-De{Xdaf8fX zWWaG8HgDbxkH-U-%Y|r^dRxf9IF7@rRjc51I-$|f_q7rVnJgHFfz#m?Hy$CR zs3>FzAw|Uj!0hZSowy=|6x3|u0#XJ5O&&rBDVqNS-bD8|yX9&I00000NkvXXu0mjf DLqEoi diff --git a/assets/lib/proekton-components/js/SelectBox.js b/assets/lib/proekton-components/js/SelectBox.js index 59f6ece..5edb2a8 100644 --- a/assets/lib/proekton-components/js/SelectBox.js +++ b/assets/lib/proekton-components/js/SelectBox.js @@ -245,7 +245,8 @@ class SelectBox { } // FILL RESULTS - let result_template = (el, id) => `
  • `; + let result_template = (el, id) => + `
  • `; // MAIN PART let $container = this.$results_box.find('.main-part ul'); fillContainer($container, result_template, search_text, self.parent_id); diff --git a/assets/lib/proekton-components/js/SelectedContainer.js b/assets/lib/proekton-components/js/SelectedContainer.js index fccc924..43e0b30 100644 --- a/assets/lib/proekton-components/js/SelectedContainer.js +++ b/assets/lib/proekton-components/js/SelectedContainer.js @@ -22,9 +22,9 @@ class SelectedContainer { let htmlTemplate = `
    - +
    ${header} - +
    ${name}
    diff --git a/assets/lib/proekton-components/js/SimpleSelect.js b/assets/lib/proekton-components/js/SimpleSelect.js index a1ad262..7f3a48c 100644 --- a/assets/lib/proekton-components/js/SimpleSelect.js +++ b/assets/lib/proekton-components/js/SimpleSelect.js @@ -108,7 +108,8 @@ class SimpleSelect { } // FILL RESULTS - let result_template = (el, id) => `
  • `; + let result_template = (el, id) => + `
  • `; // MAIN PART let $container = this.$results_box.find('.main-part ul'); fillContainer($container, result_template, search_text, self.parent_id); diff --git a/assets/projects-filter.js b/assets/projects-filter.js new file mode 100644 index 0000000..294e7d7 --- /dev/null +++ b/assets/projects-filter.js @@ -0,0 +1,45 @@ +function getFormData($form, pageNum) { + var unindexed_array = $form.serializeArray(); + var indexed_array = {}; + + $.map(unindexed_array, function (n, i) { + indexed_array[n['name']] = n['value']; + }); + indexed_array["page"] = pageNum || ""; + return indexed_array; +} + +function modUrl($form, postfix) { + let curLoc = '?' + $form.serialize() + (postfix || ""); + try { + history.replaceState($form.serialize(), null, curLoc); + } catch (e) { + console.log("Error!"); + } +} + +function sendData(url, $form, pageNum) { + function updateResults(html) { + $container.html(html); + } + + const $container = $('#projectsBlock'); + $.ajax({ + url: url, + type: "POST", + dataType: 'html', + data: getFormData($form, pageNum), + beforeSend: function (xhr) { + xhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken')); + }, + success: updateResults, + error: (data) => console.log("Error", data) + }); +} + +function sendFilterData(url) { + const $form = $('#filter-form'); + sendData('/projects/', $form); + modUrl($form); + return false; +} \ No newline at end of file diff --git a/projects/templates/partials/inc-projects-filter.html b/projects/templates/partials/inc-projects-filter.html new file mode 100644 index 0000000..11a9035 --- /dev/null +++ b/projects/templates/partials/inc-projects-filter.html @@ -0,0 +1,119 @@ +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +

    Поиск по ключевым словам и фразам

    +
    +
    +
    +
    +
    + + + + +
    +
    +

    Расширенные поля

    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + Требуется допуск (СРО) + +
    +
    + +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/projects/templates/partials/inc-projects-results.html b/projects/templates/partials/inc-projects-results.html new file mode 100644 index 0000000..d262f8d --- /dev/null +++ b/projects/templates/partials/inc-projects-results.html @@ -0,0 +1,72 @@ +

    + {% if num_results > 0 %} + Найдено {{ num_results }} проектов + {% else %} + Ничего не найдено + {% endif %} +

    +{# SORT_BY #} +{% include 'partials/inc-projects-sort_by.html' %} +
    + {% for project in projects %} +
    +
    +

    + {{ project.name }} +

    + + {% if project.realty and project.realty.name %} +
      + + {% endif %} + +

      {{ project.text|linebreaksbr|truncatechars:300 }}

      + + {% if TEMPLATE_DEBUG %} +
      Specialization: {{ project.specialization }}

      Realty location: {{ project.realty.location }}

      Constr. type: {{ project.realty.construction_type }}

      Build. classif.: {{ project.realty.building_classification }}
      + {% endif %} + +
        +
      • {{ project.created }}
      • +
      • {{ project.hit_count.hits }}
      • +
      • {{ project.answers.count }}
      • + + {% if request.user.is_authenticated %} +
      • {{ project.customer.username }}
      • + {% endif %} +
      +
    +
    +

    + {{ project.budget }} +

    + +
      + {% if project.secure_deal %} +
    • Безопасная сделка
    • + {% endif %} + +
    • + {{ project.specialization.name }} +
    • +
    +
    +
    + {% endfor %} +
    +
    + {% include 'partials/ajax_pagination.html' %} +
    \ No newline at end of file diff --git a/projects/templates/partials/inc-projects-sort_by.html b/projects/templates/partials/inc-projects-sort_by.html new file mode 100644 index 0000000..2084d3d --- /dev/null +++ b/projects/templates/partials/inc-projects-sort_by.html @@ -0,0 +1,13 @@ +
    +

    Сортировать по:

    + + {% for val, text in choices %} + + {% endfor %} + +{# #} +{# #} +
    \ No newline at end of file diff --git a/projects/templates/project_filter.html b/projects/templates/project_filter.html index ca7b083..f81d7a9 100644 --- a/projects/templates/project_filter.html +++ b/projects/templates/project_filter.html @@ -7,216 +7,22 @@ {% endblock %} {% block content %} {% include 'partials/header.html' %} -
    -
    -
    -
    + +
    +
    +

    Поиск заказов

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -

    Поиск по ключевым словам и фразам

    -
    -
    -
    -
    -
    - - - - -
    -
    -

    Расширенные поля

    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - Требуется допуск (СРО) - -
    -
    - -
    -
    -
    -
    - - -
    - {# FILTERS #} -
    -

    {{ display_msg }}

    -
    -

    Сортировать по:

    - - {% for val, text in form.order_by.field.choices %} - - {% endfor %} - - - -
    -
    - {# PROJECTS LIST #} -
    - {% for project in projects %} -
    -
    -

    - {{ project.name }} -

    - - {% if project.realty and project.realty.name %} - - {% endif %} + {# FILTER#} + {% include 'partials/inc-projects-filter.html' %} -

    {{ project.text|linebreaksbr|truncatechars:300 }}

    - - {% if TEMPLATE_DEBUG %} -
    Specialization: {{ project.specialization }}

    Realty location: {{ project.realty.location }}

    Constr. type: {{ project.realty.construction_type }}

    Build. classif.: {{ project.realty.building_classification }}
    - {% endif %} - -
      -
    • {{ project.created }}
    • -
    • {{ project.hit_count.hits }}
    • -
    • {{ project.answers.count }}
    • - - {% if request.user.is_authenticated %} -
    • {{ project.customer.username }}
    • - {% endif %} -
    -
    -
    -

    - {{ project.budget }} -

    - -
      - {% if project.secure_deal %} -
    • Безопасная сделка
    • - {% endif %} - -
    • - {{ project.specialization.name }} -
    • -
    -
    -
    - {% endfor %} -
    - - -
    - {% include 'partials/pagination.html' %} -
    - - - {% include 'partials/footer.html' %} +
    +
    + {% include 'partials/inc-projects-results.html' %}
    - + {% include 'partials/footer.html' %} +
    {% endblock %} @@ -229,6 +35,7 @@ + diff --git a/projects/views.py b/projects/views.py index 9f7d88e..4ab7b5c 100644 --- a/projects/views.py +++ b/projects/views.py @@ -286,26 +286,26 @@ def build_query(id_str, _class, *args): class ProjectFilterView(BaseMixin, View): template_name = 'project_filter.html' - form_class = ProjectFilterForm - - def get(self, request, *args, **kwargs): - context = self.get_context_data(**_.merge({}, request.GET, kwargs)) - form = self.form_class(request.GET, request=request) + # form_class = ProjectFilterForm + # renderer_classes = (TemplateHTMLRenderer,) + PROJECT_ORDER_CHOICES = ( # "Упорядочить по"... + ('name', 'названию'), + ('budget', 'цене'), + ('created', 'дате размещения'), + ('views', 'просмотрам'), + ) - projects = Project.objects.filter(state='active') - specialization = request.GET.get('specialization') - keywords = request.GET.get('keywords') - building_classification = request.GET.get('building_classification') - construction_type = request.GET.get('construction_type') - location = request.GET.get('location') - cro = request.GET.get('cro') - order_by = request.GET.get('order_by') - last_order_by = request.GET.get('last_order_by') - reverse_order = request.GET.get('reverse_order') - ord = None - manual_sort = None + def filter(self, projects, data): + # print("filter data = ", data) + specialization = data.get('specialization') + keywords = data.get('keywords') + building_classification = data.get('building_classification') + construction_type = data.get('construction_type') + location = data.get('location') + cro = data.get('cro') if keywords: + # print("keywords = ", keywords) keywords = tuple(filter(None, re.split(r'\s|,|;', keywords))) for k in keywords: @@ -334,31 +334,33 @@ class ProjectFilterView(BaseMixin, View): if cro: projects = projects.filter(cro=True) - # ORDERS - if order_by: - reverse_order = not reverse_order if order_by == last_order_by else False - ord = order_by - last_order_by = ord - elif last_order_by: - ord = last_order_by - - if ord and ord == 'views': - projects = natsort.natsorted(projects.all(), key=lambda p: p.hit_count.hits, reverse=reverse_order) - manual_sort = True - elif ord: - projects = projects.order_by('-%s' % ord if reverse_order else ord) - - context.update({ - 'last_order_by': last_order_by, - 'reverse_order': reverse_order, - }) - - project_count = len(projects) - display_msg = 'Найдено %s проектов' % project_count if project_count > 0 else 'Ничего не найдено' - - paginator = Paginator(projects if manual_sort else projects.all(), settings.PAGE_SIZE) - page = request.GET.get('page') - + return projects + + def sort_by(self, projects): + # order_by = request.GET.get('order_by') + # last_order_by = request.GET.get('last_order_by') + # reverse_order = request.GET.get('reverse_order') + # ord = None + # manual_sort = None + # + # # ORDERS + # if order_by: + # reverse_order = not reverse_order if order_by == last_order_by else False + # ord = order_by + # last_order_by = ord + # elif last_order_by: + # ord = last_order_by + # + # if ord and ord == 'views': + # projects = natsort.natsorted(projects.all(), key=lambda p: p.hit_count.hits, reverse=reverse_order) + # manual_sort = True + # elif ord: + # projects = projects.order_by('-%s' % ord if reverse_order else ord) + return projects + + def pagination(self, projects, page): + paginator = Paginator(projects, settings.PAGE_SIZE) + # print("pag page = ", page) try: projects = paginator.page(page) except PageNotAnInteger: @@ -366,16 +368,31 @@ class ProjectFilterView(BaseMixin, View): except EmptyPage: projects = paginator.page(paginator.num_pages) + return projects + + def get_context(self, request): + context = request.dict() + + projects = Project.objects.filter(state='active') + projects = self.filter(projects, request) + num_results = projects.count() + projects = self.sort_by(projects) + projects = self.pagination(projects, request.get("page")) + context.update({ - 'form': form, - # 'realty_form': realty_form, + 'choices': self.PROJECT_ORDER_CHOICES, 'projects': projects, 'is_paginated': True, - # 'page_obj': projects, - 'display_msg': display_msg, + 'page_obj': projects, + 'num_results': num_results, }) + return context - return render(request, self.template_name, context) + def get(self, request): + return render(request, self.template_name, self.get_context(request.GET)) + + def post(self, request): + return render(request, 'partials/inc-projects-results.html', self.get_context(request.POST)) class CustomerProjectCreateView(BaseMixin, View): diff --git a/templates/partials/ajax_pagination.html b/templates/partials/ajax_pagination.html new file mode 100644 index 0000000..67b2b34 --- /dev/null +++ b/templates/partials/ajax_pagination.html @@ -0,0 +1,65 @@ +{% if is_paginated %} + + + +{% endif %} \ No newline at end of file From 605a8e0ad223d1554952d42d008e947f83d884bc Mon Sep 17 00:00:00 2001 From: booblegum Date: Fri, 11 Nov 2016 10:45:58 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9A=D0=BE=D1=81=D1=82=D1=8B=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Увеличено максимальное кол-во объектов получаемых единовременно по api --- archilance/settings/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archilance/settings/base.py b/archilance/settings/base.py index 2a0274e..4b7de8e 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -271,7 +271,7 @@ LOGIN_REDIRECT_URL = '/projects/' LOGIN_URL = '/users/login/' PAGE_SIZE = 10 # Non-api page size (regular views) -API_PAGE_SIZE = 100 # Django REST framework +API_PAGE_SIZE = 2000 # Django REST framework REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [