wagtail-generic-chooser | A toolkit for custom chooser popups in Wagtail | Content Management System library
kandi X-RAY | wagtail-generic-chooser Summary
kandi X-RAY | wagtail-generic-chooser Summary
wagtail-generic-chooser provides base classes for building chooser popups and form widgets for the Wagtail admin, matching the look and feel of Wagtail's built-in choosers for pages, documents, snippets and images. It differs from existing model chooser add-ons (Naeka/wagtailmodelchooser, neon-jungle/wagtailmodelchooser, springload/wagtailmodelchoosers) in that it is designed to be fully configurable through subclassing - in particular, it can be used on data sources other than Django models, such as REST API endpoints. It is intended that wagtail-generic-chooser will be expanded to cover all the functionality of Wagtail's built-in choosers, such as inline object creation forms, and will then be incorporated into Wagtail as the new base implementation of those built-in choosers - this will reduce code duplication and greatly simplify the process of building new admin apps.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handle the GET request
- Adds the context to the context
- Returns True if the create form is available
- Returns whether the user can create or not
- Return JS arguments
- Render widget
- Return data for a widget
- Return the URL to edit item
- Handles GET requests
- Returns the URL for the edit item
- Return the response data for the selected item
- Render the selected item
- Get a paginated list of objects
- Return the API parameters
- Returns a list of objects for a given page number
- Return list of objects
- Returns a list of objects that match the search term
- Returns a filtered list of objects
- Get an instance by id
- Get a single object by id
- Get list of objects
wagtail-generic-chooser Key Features
wagtail-generic-chooser Examples and Code Snippets
Community Discussions
Trending Discussions on wagtail-generic-chooser
QUESTION
I am using wagtails wagtail-generic-chooser to create customChoosers for my data models and it is working great whenever I am referencing other modelAdmin models.
However, I have come across a situation where I have a Lexis model with a field that has a FK link to itself. The idea is to have a Lexis term, and then there can be related lexis terms connected to it. It works fine with a normal FieldPanel but this isn't a very good UI experience when there are hundreds of lexis terms. Accordingly, I wanted to create a custom LexisChooser for this field. However, the issue I've run into is according to the documentation in order to create a functional widget, I am required to create both a view and adminChooser that references the model the ChooserPanel is connected to.
https://github.com/wagtail/wagtail-generic-chooser#chooser-widgets-model-based
This makes sense, however, when I then try to import my LexisChooser into my Lexis model to use the LexisChooser as a widget, I get the error below.
ImportError: cannot import name 'Lexis' from 'lexis.models'
I realize this is due to a circular import error issue because I have subclasses that are importing the Lexis Class in order to build the LexisChooser widget and then I am trying to import that widget into the Lexis Class.
I know this isn't a bug with Wagtail nor is it a problem with wagtail-generic-chooser, However, does anyone have any idea how I can refactor the code to make this function so that I can use a LexisChooser on a field of the Lexis Model.
Below is my code.
views.py create a view ...ANSWER
Answered 2020-Mar-29 at 05:16Split your models file into two separate files containing Lexis
and LexisLink
, as demonstrated in the documentation.
Then LexisLink
can refer to LexisChooser
while it cleanly refers to the Lexis
model.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install wagtail-generic-chooser
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page