-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'set' object does not support indexing #93
Comments
Something is expecting a list and instead its getting a set. maybe this is the problem: Client.objects.filter(Q(name__icontains=q)) Q should always be used with | to mean "OR" so it would be Django that is choking. look at the full stack trace to see where the error happens |
Thanks. Just removed the .objects.filter(Q(name__icontains=q)) with .objects.filter(name__icontains=q) The error still remains. I have pasted my full stack trace here: http://pastebin.com/Mn4utdZv From what I see, the error is shown in .get_form(), but can't seem to identify it. Please have a look if you can help me with this. Regards. |
oh I see it: this is a python set: {'client.lookups','ClientLookup'}, this is a python dict: {'client.lookups': 'ClientLookup'}, , vs : I've been caught by that one before. greetings to nepal ! I'll make it there someday soon |
Thanks, it worked. Exception Type: KeyError It still concerns that very file. I think I should create a new issue with it. The full stack trace is here: http://pastebin.com/iad9GxGT |
I made it work the simple way, instead of using Forms and Lookups. This solved my problem for now. You might want to change the comma to colon in your instructions. Cheers. |
the README says:
there are two ways to specify. by tuple or by dict I'll make the instructions clearer, since its too easy to not notice such a btw. when you post a stacktrace click on the >
so I can see the whole stacktrace. thanks, On Fri, Oct 24, 2014 at 12:52 PM, Nitesh Rijal notifications@github.com
|
Hello.
I'm trying to use make_ajax_field() for the autocompletion. I have followed the installation instruction as well as the example app thoroughly. I keep getting the error 'set' object does not support indexing. What is this related to? Any insight would be very helpful.
These are my settings and codes:
settings.py
Settings for ajax_select
AJAX_LOOKUP_CHANNELS = {
'client_lookup': {'client.lookups','ClientLookup'},
'driver_lookup': {'driver.lookups','DriverLookup'},
}
admin.py
class LoadingAdmin(AjaxSelectAdmin):
form = LoadingForm
forms.py
from django import forms
from ajax_select import make_ajax_field
from data_entry.models import Loading
class LoadingForm(forms.ModelForm):
lookups.py
from django.db.models import Q
from django.utils.html import escape
from client.models import Client
from ajax_select import LookupChannel
class ClientLookup(LookupChannel):
PS: I have enabled db_index=True in the 'name' field that I'm trying to search.
The text was updated successfully, but these errors were encountered: