python,django,django-autocomplete-light
I ended up installing django as suggested (I need to use django 1.5 for GAE compatibility): pip install -e git+https://github.com/django/[email protected]#egg=django So I got further, but now it is saying: ImportError: No module named autocomplete_light.example_apps.non_admin_add_another I see that the module is referenced in settings.py: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites',...
django,django-autocomplete-light
Following resolved my problem: before admin in INSTALLED_APPS INSTALLED_APPS = ( 'autocomplete_light', 'django.contrib.admin', ) autocomplete_light_registry.py class BannerAutocomplete(autocomplete_light.AutocompleteModelBase): model = Banner search_fields = ('name',) # banner_obj.product.name choices = Product.objects.all() limit_choices = 20 autocomplete_light.register( BannerAutocomplete, attrs={ 'placeholder': _(u'имя товара'), 'data-autocomplete-minimum-characters': 1, }, ) Manually select autocomplete for related field in your...
django,django-models,django-forms,django-autocomplete-light
After going through various documents, the solution which worked as correctly as it should be is def choices_for_request(self): category = self.request.session.get('category','') item=self.request.GET.get('q','') choices = self.choices.all() if item: choices = choices.filter(item_name__icontains=item) super(AutoComplete, self).choices_for_request() if category: choices = choices.filter(product_type__name=category) return self.order_choices(choices)[0:self.limit_choices] I missed out item=self.request.GET.get('q','') autocomplete-light...
python,django,sqlite,dictionary,django-autocomplete-light
I did it as simple add another like in administration panel: http://django-autocomplete-light.readthedocs.org/en/stable-2.x.x/addanother.html
django,django-models,django-forms,django-admin,django-autocomplete-light
Typo: choiches in choiches = MyModels.objects.filter( ...
python,django,django-models,django-forms,django-autocomplete-light
You have forgottent a comma! Change search_fields=('item_name') to search_fields=('item_name',) search_fields should be an iterable, so if it has the value ('item_name') (which is a string) it will get 'i', 't', 'e', etc (that's why you get the message Cannot resolve keyword u'i' into field) Also, there are some serious problems...
django,django-models,django-forms,django-autocomplete-light
The self.request.POST (or self.request.GET) QueryDict of an Autocomplete class will not contain any more information than the search query because they are not passed when the view is created (so self.request.POST.get('category', 'none') will always return 'none'). So the difficult part is to somehow pass an argument (category) to a completely...