Changes between Initial Version and Version 1 of Ticket #29582


Ignore:
Timestamp:
Jul 20, 2018, 2:42:42 PM (6 years ago)
Author:
Tim Graham
Comment:

The problem seems to be hardcoded Value(''), regardless of the field type. I'm not sure what the proper resolution is.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29582

    • Property Component Uncategorizedcontrib.postgres
    • Property Triage Stage UnreviewedAccepted
    • Property Summary postgresql SearchVector error when try to add integerfield to itSearchVector doesn't support querying non-text fields
    • Property Type UncategorizedBug
  • Ticket #29582 – Description

    initial v1  
    1 Hi,
    2 
    31I try to implement autocomplete on my place table that look like below:
    4 
    5 **  class Place(models.Model):
     2{{{
     3class Place(models.Model):
    64    name = models.CharField(max_length=80, blank=True)
    75    num = models.IntegerField(null=True)
     
    1614        address = "{0}, {1}, {2}, {3}".format(self.num, self.street,
    1715                                              self.postal_code, self.city, self.country)
    18         return address**
    19 
     16        return address
     17}}}
    2018and in my function that return the result for display my address on frontend is like (self.q is a GET param from ajax call):
    2119
    22 **qs = Place.objects.all()
    23 qs.annotate(search=SearchVector('street', 'country','city', 'num')).filter(search__icontains=self.q)**
    24 
    25 
     20{{{
     21qs = Place.objects.all()
     22qs.annotate(search=SearchVector('street', 'country','city', 'num')).filter(search__icontains=self.q)
     23}}}
    2624I have this error when the ajax call run:
    27 
     25{{{
    2826  File "/opt/coupdepouce/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
    2927    return self.cursor.execute(sql, params)
    3028django.db.utils.DataError: invalid input syntax for integer: ""
    3129LINE 1: ...city", '') || ' ' || COALESCE("user_place"."num", '')) AS "s...
    32 
    33 
     30}}}
Back to Top