question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding `q=...` to admin filtered image admin listing causes crash.

See original GitHub issue

Issue Summary

If you try to combine ?q= search type URL with filtering by collection in the Image view, you get a crash. (AttributeError at /admin/images/)

  File "/Users/daniel/tmp/search-crash/.v/lib/python3.10/site-packages/wagtail/images/views/images.py", line 96, in get_context_data
    context = super().get_context_data(**kwargs)
  File "/Users/daniel/tmp/search-crash/.v/lib/python3.10/site-packages/wagtail/images/views/images.py", line 67, in get_context_data
    images = images.filter(collection=self.current_collection)

Exception Type: AttributeError at /admin/images/
Exception Value: 'SQLiteSearchResults' object has no attribute 'filter'

(We have a client who wants to be able to search within an image collection, so were exploring options)

Steps to Reproduce

  1. Start a new project with wagtail start myproject
  2. cd myproject
  3. ./manage.py migrate
  4. ./manage.py createsuperuser
  5. ./manage.py runserver
  6. http://localhost:8000/admin/images/?collection_id=1&q=1

Crash.

  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: (yes)

Technical details

  • Python version: 3.8, 3.9, 3.10
  • Django version: 3.2, 4.0
  • Wagtail version: 2.15, 2.16.1
  • Browser version: N/A
  • Search backends: SQLLite, Postgres (database backend) and ElasticSearch backends all have this.

e.g:

'SQLiteSearchResults' object has no attribute 'filter'
'Elasticsearch6SearchResults' object has no attribute 'filter'
'PostgresSearchResults' object has no attribute 'filter'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lb-commented, Mar 9, 2022

Go for it. Nothing stopping you or anyone picking up a bug to fix. @ParitoshKabra

I would recommend for something like this you start with the unit test, sometimes finding where to add a test can be tricky and PRs must come with a test to ensure won’t break this again in the future.

0reactions
lb-commented, Mar 10, 2022

Thanks for digging into this @ParitoshKabra

  1. The search losing the collection is a known issue - https://github.com/wagtail/wagtail/issues/4073 (feel free to investigate)
  2. Search indexing by default is basic, it depends on the search backend used. https://docs.wagtail.org/en/stable/topics/search/backends.html - I’m not very skilled in the search area though so maybe that could also be improved

There is also this issue that may be related. https://github.com/wagtail/wagtail/issues/3746

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wagtail Admin Images Crash - django - Stack Overflow
Try removing some of the more recent or larger images and reloading the page. The problem could be the result of a corrupt...
Read more >
Chapter 7. Kernel crash dump guide - Red Hat Customer Portal
kdump is a service which provides a crash dumping mechanism. The service enables you to save the contents of the system memory for...
Read more >
EVERY ADMIN PROGRAM CRASHES - Microsoft Community
Click on the Startup Tab and click open task manager. This will open another window which contains all your startup applications on the...
Read more >
React-admin - Filtering the List
React-admin uses the filter query parameter from the URL to determine the filters to apply to the list. To change the filters, react-admin...
Read more >
User Guide - Cold Turkey
Blocker needs admin rights for various reasons and there's no way to install ... To add a website to the list, type the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found