diff --git a/requirements.txt b/requirements.txt index 87bac65..865221d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ certifi==2017.4.17 chardet==3.0.3 -Django==1.10.1 +Django==1.11.15 git+https://github.com/djangonauts/django-hstore@61427e474cb2f4be8fdfce225d78a5330bc77eb0#egg=django-hstore -git+https://github.com/informatic/django-tree@993cec827ed989d3c162698a739da95b9227604b#egg=django-tree +git+https://github.com/d42/django-tree@687c01c02d91cada9ca1912e34e482da9e73e27a#egg=django-tree django-appconf==1.0.2 django-auth-ldap==1.2.12 -Django-Select2==5.8.10 +Django-Select2==6.3.1 djangorestframework==3.5.4 Pillow==3.3.1 -psycopg2==2.6.2 +psycopg2==2.7.5 djangorestframework-hstore==1.3 pyldap==2.4.28 requests==2.16.5 diff --git a/storage/admin.py b/storage/admin.py index 8fb7ab5..6755f32 100644 --- a/storage/admin.py +++ b/storage/admin.py @@ -14,7 +14,7 @@ class ItemForm(forms.ModelForm): model = Item exclude = [] widgets = { - 'parent': ItemSelectWidget, + 'parent': ItemSelectWidget(model=Item), 'categories': Select2MultipleWidget, 'props': PropsSelectWidget } diff --git a/storage/views.py b/storage/views.py index b5ebec6..b8e2a93 100644 --- a/storage/views.py +++ b/storage/views.py @@ -125,8 +125,7 @@ class PropSelectView(AutoResponseView): select skeys(props) as e, count(skeys(props)) as e_count from storage_item group by e order by e_count desc) as xD where e like %s limit 10;""", ['%' + self.term + '%']) - props = c.fetchall() - + props = [e[0] for e in c.fetchall()] return JsonResponse({ 'results': [ { diff --git a/storage/widgets.py b/storage/widgets.py index 8c254d6..82c1906 100644 --- a/storage/widgets.py +++ b/storage/widgets.py @@ -36,13 +36,13 @@ class PropsSelectWidget(DictionaryFieldWidget): # get default HTML from AdminTextareaWidget html = AdminTextareaWidget.render(self, name, value, attrs) # prepare template context - template_context = Context({ + template_context = { 'field_name': name, 'STATIC_URL': settings.STATIC_URL, 'use_svg': parse_version(get_version()) >= parse_version('1.9'), # use svg icons if django >= 1.9 'ajax_url': reverse('prop-complete'), - 'w': w.build_attrs() - }) + 'w': w.build_attrs(base_attrs=w.attrs) + } # get template object template = get_template('hstore_%s_widget.html' % self.admin_style) # render additional html