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.

Generic chooser views

See original GitHub issue

Introduce a wagtail.admin.views.generic.chooser module to serve as a common base implementation for chooser modals. This can be loosely based on wagtail-generic-chooser but should incorporate improvements as outlined in https://github.com/wagtail/wagtail-generic-chooser/issues/44: in particular, using the table UI component for listing views, and using ‘partial’ HTML fragments for the browser results view and ‘create’ form submission so that we aren’t re-rendering the whole modal.

Acceptance criteria:

  • A documented base set of views exists in wagtail.admin.views.generic.chooser (#8662)
  • A documented viewset exists in wagtail.admin.viewsets.chooser (#8662)
  • A base chooser widget implementation is provided and documented (#8662)
  • A base StreamField chooser block is provided and documented (#8820)
  • The page chooser mechanism inherits from this base implementation
  • The image chooser mechanism inherits from this base implementation (#8778, #8804)
  • The snippet chooser mechanism inherits from this base implementation (#8711, #8717)
  • The document chooser mechanism inherits from this base implementation (#8776, #8777)
  • A basic chooser for an arbitrary model can be implemented with minimal new code - simply extending the base viewset/widget class and specifying the model as an attribute (#8662)
  • New instances can be created through the chooser view (#8726)
  • The listing view uses the wagtail.admin.ui.tables component (#8662)
  • Listings are searchable (where the model provides this) (#8669)
  • Listings are filterable via django-filters filters
  • Data sources other than models (e.g. django-rest-framework API endpoints) can be used (#8855)
  • Where custom logic is common to chooser modals and widgets (e.g. converting an object ID to a dict representation that can be used for widget rendering), code is shared between them

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gasmancommented, May 12, 2022

@lb- Yep, the plan is to deprecate wagtail-generic-chooser - so yes, reviewing those open issues is a good plan. From a quick scan through the list, there’s a mix of things I hope to address in the rewrite (better filtering via django-filters, cleaner API for DRF data sources) and more general wishlist items that are probably a better fit for the Wagtail project anyhow (multiple selection, generalised link choosing).

1reaction
phildextercommented, May 4, 2022
  1. We can choose basic Snippets using the new chooser (from the chooser widget or a streamfield block).
  2. We can create a new Snippet through the new chooser (from the chooser widget or a streamfield block).
  3. We can search for a Snippet through the new chooser (from the chooser widget or a streamfield block).
  4. We can filter objects through the new chooser.
  5. We can do 1-4 for documents.
  6. We can do 1-4 for images.
  7. We can do 1, 3 and 4 for pages.
  8. We can do 1-4 for sources other than models stored within the Wagtail DB
  9. Documentation on how to extend
Read more comments on GitHub >

github_iconTop Results From Across the Web

wagtail-generic-chooser - GitHub
Chooser views can be used independently of chooser widgets; they are used by rich text editors, for example. Chooser views (model-based). The generic_chooser....
Read more >
Generic views - Wagtail's documentation
Wagtail provides a number of generic views for handling common tasks such as creating / editing model instances, and chooser modals.
Read more >
wagtail-generic-chooser - PyPI
A toolkit for custom chooser popups in Wagtail. ... wagtail-generic-chooser 0.5. pip install wagtail-generic-chooser. Copy PIP instructions.
Read more >
wagtail-generic-chooser widget (NoReverseMatch)
I have an event model referencing an event category model. Both the event category model and the event model are set up as...
Read more >
wagtail-generic-chooser - Django Packages
Projects listed on Djangopackages are third-party packages. They are not vetted nor endorsed by the Django Software Foundation. Use them at your own...
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