Error in search backends when uploading an Image
See original GitHub issueIssue Summary
So when I am uploading an image with postgres database, I get an error and get stuck on an Image Chooser
File "/usr/local/lib/python3.8/site-packages/wagtail/search/backends/database/postgres/postgres.py", line 126, in title
for current_field, boost, value in self.prepare_field(self.obj, field):
File "/usr/local/lib/python3.8/site-packages/wagtail/search/backends/database/postgres/postgres.py", line 63, in prepare_field
get_weight(field.boost),
File "/usr/local/lib/python3.8/site-packages/wagtail/search/backends/database/postgres/weights.py", line 59, in get_weight
return weight
UnboundLocalError: local variable 'weight' referenced before assignment
I think it’s a quick fix, so no need to explain it more 😉
Technical details
- Python version: 3.9.5.
- Django version: 4.0.4.
- Wagtail version: 3.0.
- Browser version: Firefox 101
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Getting an error when uploading an image, using django ...
Getting an error when uploading an image, using django-storages ... I've seen several people submit issues with using the S3 backend but ...
Read more >Uploading image throws error "The file received is not a valid ...
When uploading images via the API for some images an error 'The file received is not a valid image' is received. Uploading a...
Read more >Image upload , File not getting uploaded to backend (no error ...
I am trying to upload an image in angular 2 , i have no error listed but there is no change in the...
Read more >Error while uploading the backend table to sharepoint by wizard
I uploaded for the test purpose one my table having few records only (Table has a Numeric field called IDrecord - and set...
Read more >HTTP Error when uploading images - WordPress.org
I've tried deactivating the latest plugin and cleared cache before trying to upload more images. That did not work. I did try uploading...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ohhhh… Found it!
wagtail.search
was not added toINSTALLED_APPS
setting, so everything was falling apart. I tried to overrideCustomImage
s search_fields and gotrelation "wagtailsearch_indexentry" does not exist
, so I wondered ifwagtail.search
is even installed…No, I already used
wagtail
3 withpostgres
database, everything is working as expected…Yeeah, that’s true, it was strange for me that I couldn’t find anything about this… I’m using a
wagtail-pipit
template for my project, so there’s a lot of code changes… Maybe a customImage
model is causing problems? But I didn’t yet change anything in it…That’s a strange bug because nothing is changed about search… What can cause this?
Update: Custom Image model is not causing any problems 😄