Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Column objects on list_export for SnippetViewSet #11781

Open
cyface opened this issue Mar 21, 2024 · 1 comment · May be fixed by #11834
Open

Support Column objects on list_export for SnippetViewSet #11781

cyface opened this issue Mar 21, 2024 · 1 comment · May be fixed by #11834

Comments

@cyface
Copy link
Contributor

cyface commented Mar 21, 2024

Is your proposal related to a problem?

Currently, for situations where we need to use a wagtail.admin.ui.tables.Column object in the list_display property of a SnippetViewSet, we often need to use that same Column in the list_export.

But today SnippetViewSets don't support Column objects in list_export, only in list_display. So we are unable to make the export match the display.

Describe the solution you'd like

Support using wagtail.admin.ui.tables.Column objects in list_export for SnippetViewSets.

Describe alternatives you've considered

  • Custom list_export handler class.
  • Monkey patching

Additional context

Today in a SnippetViewSet for Tags, if we want to include things like number of pages and images that use that tag, we have a Column class that does that calculation. We used to have a method directly on the ModelViewSet, but that stopped working when we converted to SnippetViewSets. So now we use a pair of Column objects to handle those calculations.

On a typical Model, you could just add the methods to the Model itself, but we don't control the Tag model, since it's owned by taggit. Hence why we originally had the methods on the ModelViewSet, and now in Column objects.

@abdlrhman08
Copy link
Contributor

abdlrhman08 commented Apr 4, 2024

Hey @cyface , can you take a look at abdlrhman08/wagtail@a43cf6b and 370cfdf. Let me know if they give you the correct values and proper output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants