From 63ee76a7030dd0cbc6a007f9ed9210a059ceff55 Mon Sep 17 00:00:00 2001 From: ya_dim4ik Date: Wed, 11 Jan 2017 16:15:17 +0200 Subject: [PATCH] =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BF=D0=BB=D0=B8=D1=82=20=D0=B3=D0=BE=D1=80=D0=BE=D0=B4=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B2=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ city/admin.py | 2 +- city/search_indexes.py | 1 - static/custom_js/main.js | 12 +++++++----- templates/client/includes/header.html | 6 +++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d35169c9..ac6b4b52 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ cd /opt/solr-4.10.4 bin/solr start -p 8983 ``` +Если возникает ошибка Solr: [Reason: Error 404 Not Found] - http://stackoverflow.com/a/30633740 + # ```sh python manage.py migrate expobanner 0001 --fake diff --git a/city/admin.py b/city/admin.py index e8e7bccf..34a05fc7 100644 --- a/city/admin.py +++ b/city/admin.py @@ -99,8 +99,8 @@ def city_change(request, url): return render_to_response('city_add.html', args) + def search_city(request): - # country = request.GET.get('country') term = request.GET.get('term') # if not term: # qs = City.objects.language().filter(country=country)[:200] diff --git a/city/search_indexes.py b/city/search_indexes.py index 7fd826d4..676dc91f 100644 --- a/city/search_indexes.py +++ b/city/search_indexes.py @@ -29,7 +29,6 @@ class CityIndex(indexes.SearchIndex, indexes.Indexable, ExpoSearchMixin): return City def index_queryset(self, using=None): - return self.get_model().used.all() def get_updated_field(self): diff --git a/static/custom_js/main.js b/static/custom_js/main.js index acc2173e..0aeec8e8 100644 --- a/static/custom_js/main.js +++ b/static/custom_js/main.js @@ -238,22 +238,25 @@ $(document).ready(function(){ // end on-of events if( $("#id_city" ).length ) { $('#id_city').select2({ - placeholder: "Город", - width: 'element', - ajax: { + placeholder: "Город", + width: 'element', + ajax: { url: "/admin/city/search/", dataType: "json", quietMillis: 200, data: function(term, page, country){ - var country = $('#id_country').val() + var country = $('#id_country').val(); return {term: term, page: page, country: country}; }, results: function (data) { + if (typeof(data) == 'string'){ + data = JSON.parse(data); + } var results = []; $.each(data, function(index, item){ results.push({ @@ -268,7 +271,6 @@ $(document).ready(function(){ var id= $(element).val(); var text = $(element).attr('data-init-text'); callback({id: id, text:text}); - } }); diff --git a/templates/client/includes/header.html b/templates/client/includes/header.html index d90cbd4b..5affc24b 100644 --- a/templates/client/includes/header.html +++ b/templates/client/includes/header.html @@ -89,7 +89,7 @@
{# {% trans 'настройки' %}#} - + {% if user.is_superuser %} {% endif %} @@ -105,8 +105,8 @@