Ver código fonte

Withdraw changes for autocompleting category fullpath in the category form

master
Asia Biega 13 anos atrás
pai
commit
24535ab84a

+ 0
- 3
oscar/apps/dashboard/catalogue/app.py Ver arquivo

@@ -46,9 +46,6 @@ class CatalogueApplication(Application):
46 46
                 name='catalogue-category-create'),
47 47
             url(r'^categories/update/(?P<pk>\d+)/$', self.category_update_view.as_view(),
48 48
                 name='catalogue-category-update'),
49
-
50
-            url(r'^categories-autocomplete/$', views.category_autocomplete,
51
-                name='catalogue-category-autocomplete'),
52 49
         )
53 50
         return self.post_process_urls(urlpatterns)
54 51
 

+ 0
- 27
oscar/apps/dashboard/catalogue/forms.py Ver arquivo

@@ -1,7 +1,6 @@
1 1
 from django import forms
2 2
 from django.forms.models import inlineformset_factory
3 3
 from django.db.models import get_model
4
-from django.utils.translation import ugettext as _
5 4
 
6 5
 from treebeard.forms import MoveNodeForm
7 6
 
@@ -15,32 +14,6 @@ ProductImage = get_model('catalogue', 'ProductImage')
15 14
 
16 15
 class CategoryForm(MoveNodeForm):
17 16
 
18
-    _ref_node_id = forms.CharField(required=False,
19
-                                   label=_(u"Relative to (category)"))
20
-
21
-    def __init__(self, *args, **kwargs):
22
-        super(CategoryForm, self).__init__(*args, **kwargs)
23
-        if self.initial:
24
-            ref_pk = self.initial['_ref_node_id']
25
-            if ref_pk:
26
-                try:
27
-                    c = Category.objects.get(pk=ref_pk)
28
-                except Category.DoesNotExist:
29
-                    self.initial['_ref_node_id'] = ''
30
-                else:
31
-                    self.initial['_ref_node_id'] = c.full_name
32
-
33
-    def clean__ref_node_id(self):
34
-        cd = self.cleaned_data
35
-        if '_ref_node_id' in cd and cd['_ref_node_id']:
36
-            try:
37
-                c = Category.objects.get(full_name=cd['_ref_node_id'])
38
-            except Category.DoesNotExist:
39
-                raise forms.ValidationError(_('The specified category does not exist'))
40
-            else:
41
-                cd['_ref_node_id'] = c.pk
42
-        return cd['_ref_node_id']
43
-
44 17
     class Meta(MoveNodeForm.Meta):
45 18
         model = Category
46 19
 

+ 1
- 10
oscar/apps/dashboard/catalogue/views.py Ver arquivo

@@ -1,14 +1,12 @@
1 1
 from django.views import generic
2 2
 from django.db.models import get_model
3
-from django.http import HttpResponseRedirect, HttpResponse
3
+from django.http import HttpResponseRedirect
4 4
 from django.contrib import messages
5 5
 from django.core.urlresolvers import reverse
6 6
 
7 7
 from oscar.apps.dashboard.catalogue import forms
8 8
 from oscar.core.loading import get_classes
9 9
 
10
-import simplejson
11
-
12 10
 ProductForm, CategoryForm, StockRecordForm, StockAlertSearchForm, ProductCategoryFormSet, ProductImageFormSet = get_classes(
13 11
     'dashboard.catalogue.forms', ('ProductForm', 'CategoryForm', 'StockRecordForm',
14 12
                                   'StockAlertSearchForm',
@@ -281,10 +279,3 @@ class CategoryUpdateView(generic.UpdateView):
281 279
         else:
282 280
             return reverse("dashboard:catalogue-category-detail-list", 
283 281
                             args=(parent.pk,))
284
-
285
-
286
-def category_autocomplete(request):
287
-    q = request.GET.get('term', '')
288
-    categories =Category.objects.filter(full_name__icontains=q)
289
-    result = [c.full_name for c in categories]
290
-    return HttpResponse(simplejson.dumps(result))

+ 0
- 12
oscar/static/oscar/js/oscar/dashboard.js Ver arquivo

@@ -85,18 +85,6 @@ oscar.dashboard = {
85 85
                 }
86 86
             );
87 87
         }
88
-    },
89
-    catalogue: {
90
-        init: function() {
91
-        },
92
-        category_autocomplete: function(url) {
93
-            return function () {
94
-                $("#id__ref_node_id").autocomplete({
95
-                    'source': url,
96
-                    'minLength': 3,
97
-                });
98
-            }
99
-        }
100 88
     }
101 89
 };
102 90
 

+ 0
- 7
oscar/templates/dashboard/catalogue/category_create.html Ver arquivo

@@ -2,13 +2,6 @@
2 2
 {% load category_tags %}
3 3
 {% block body_class %}catalogue{% endblock %}
4 4
 
5
-{% block extrascripts %}
6
-    {{ block.super }}
7
-    <script type="text/javascript">
8
-        $(oscar.dashboard.catalogue.category_autocomplete("{% url dashboard:catalogue-category-autocomplete %}"));
9
-    </script>
10
-{% endblock %}
11
-
12 5
 {% block title %}
13 6
 Category management | {{ block.super }}
14 7
 {% endblock %}

+ 0
- 7
oscar/templates/dashboard/catalogue/category_list.html Ver arquivo

@@ -2,13 +2,6 @@
2 2
 {% load category_tags %}
3 3
 {% block body_class %}catalogue{% endblock %}
4 4
 
5
-{% block extrascripts %}
6
-    {{ block.super }}
7
-    <script src="{{ STATIC_URL }}oscar/js/jquery/jquery-ui-1.8.21.custom.min.js" type="text/javascript" charset="utf-8"></script>
8
-    <script src="{{ STATIC_URL }}oscar/js/sortable/jquery.ui.nestedSortable.js" type="text/javascript" charset="utf-8"></script>
9
-    <script type="text/javascript">$(oscar.dashboard.catalogue.init);</script>
10
-{% endblock %}
11
-
12 5
 {% block title %}
13 6
 Category management | {{ block.super }}
14 7
 {% endblock %}

+ 1
- 1
oscar/templates/dashboard/layout.html Ver arquivo

@@ -82,6 +82,6 @@ Dashboard | {{ block.super }}
82 82
     {{ block.super }}
83 83
     <script src="{{ STATIC_URL }}oscar/js/oscar/ui.js" type="text/javascript" charset="utf-8"></script>
84 84
     <script src="{{ STATIC_URL }}oscar/js/oscar/dashboard.js" type="text/javascript" charset="utf-8"></script>
85
-    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
85
+    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>
86 86
 	<script type="text/javascript">$(oscar.dashboard.init);</script>
87 87
 {% endblock %}

+ 0
- 1
requirements.txt Ver arquivo

@@ -14,4 +14,3 @@ PyHamcrest==1.6
14 14
 South==0.7.3
15 15
 purl==0.3.2
16 16
 django-sorting==0.1
17
-simplejson==2.5.2

+ 0
- 1
setup.py Ver arquivo

@@ -34,7 +34,6 @@ setup(name='django-oscar',
34 34
           'sorl-thumbnail==11.12',
35 35
           'python-memcached==1.48',
36 36
           'django-sorting==0.1',
37
-          'simplejson==2.5.2',
38 37
           ],
39 38
       # See http://pypi.python.org/pypi?%3Aaction=list_classifiers
40 39
       classifiers=['Environment :: Web Environment',

Carregando…
Cancelar
Salvar