django-pg-fts icon indicating copy to clipboard operation
django-pg-fts copied to clipboard

Django 1.8 AttributeError: 'Col' object has no attribute 'source'

Open pajooh opened this issue 10 years ago • 10 comments

this happens when i'm trying to use __search lookup in an fts index field. the error comes from fields.py in as_sql[282]

pajooh avatar Jan 24 '15 12:01 pajooh

@pajooh, sorry for the late response, and tnx for reporting this case. Can you show an example, so i can reproduce the error.

dvdmgl avatar Jan 26 '15 21:01 dvdmgl

Actually, i'm trying to use this package alongside django-filter to get a full text search box on a list. i added a TSVectorField named ftx_index with required migrations, and the added this into views:

class WorksSearch(django_filters.FilterSet):
    filter_overrides = {
        TSVectorField: {
            'filter_class': django_filters.CharFilter,
            'extra': lambda f: {
                'lookup_type': 'search',
                }
        }
    }
    class Meta:
        model = Work
        fields = [ 'fts_index']

def works_list(request):
    works = WorksSearch(request.GET, queryset=Work.objects.all())
    return render_to_response('work_filter.html', {'filter': works})

the 'lookup_type': 'search' config tell's django-filter to make a __search lookup. if this data is not sufficient, let me know.

pajooh avatar Jan 27 '15 06:01 pajooh

I still can't reproduce the error. Added this case to test_query.py, Can you check request.GET.

dvdmgl avatar Jan 27 '15 17:01 dvdmgl

the request.GET is as it should be: it contains the search term fts_index :u'cultur'

pajooh avatar Feb 01 '15 07:02 pajooh

i was using Django 1.8a1, downgrading it to 1.7 resolved the issue. my app should work with django 1.8. could you please check if the issue could be fixed?

pajooh avatar Feb 03 '15 08:02 pajooh

sorry again for the late response, apparently the freaking gmail filter isn't working. i'm waiting for the 1.8 beta release to work on this issue.

dvdmgl avatar Feb 23 '15 23:02 dvdmgl

django 1.8 beta is out!

pajooh avatar Mar 01 '15 15:03 pajooh

I am also trying this on Django 1.8, ran into the same error. Could you please fix this?

ramashishb avatar Jul 22 '15 06:07 ramashishb

Any update?

aehlke avatar Sep 07 '15 21:09 aehlke

Any update? I am also stuck in this bug.

nuhbye avatar Sep 18 '15 08:09 nuhbye