-
Notifications
You must be signed in to change notification settings - Fork 46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we agreed to just use the ModelAdmin package for other projects. However as this is our own project, I'm wondering if we can update it to use snippets.
It looks like the model admin is only used for the Taxonomy section, with just the Service model. It was added in 2019, and the customisation is mainly to display the usage count. Usage count is now part of Wagtail core. I think we can ditch the whole customisation and just add Service as a standard snippet.
Or if have the time, we could also add custom SnippetViewSet, to load the Service admin page in the same URL as before, and perhaps displaying the usage count on the listing so it can be seen in one glance. It looks quite straightforward.
Another more compelling reason to ditch the existing modeladmin code is that the usage count is broken. E.g. click on a usage on this page /admin/taxonomy/service/
I didn't spot this earlier as this is a rarely used feature.
81e25fe
to
2e2aeff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Well done for adding the snippet admin group to map the Taxonomy menu item.
Just need to remove the get_admin_urls_for_registration()
method from the snippet view class as it is a model admin method. Also I included some small nice-to-have customisation for the Services admin listing.
When I tested locally, the usage count is always 0 for the Service snippets, somehow, though the Service type is used in some blog posts. Even after running rebuild_references_index
, they are 0. I'm not sure why. We might have to troubleshoot this on a separate ticket if this feature is required. Just something to note.
It shouldn't hold us back as the previous implementation is already broken and not showing usage anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you for your work!
6d5f14e
to
14259b2
Compare
Any chance we can get this in? cc @helenb |
@zerolab On the board it is with Anna for internal testing. I'll ask her where we are with it. |
Add and enable image optimizers
This upgrades Wagtail to 5.1
Support ticket: https://torchbox.monday.com/boards/1130687432/pulses/1264168986
Wagtail 5.1 release notes: https://docs.wagtail.org/en/stable/releases/5.1.html#
Changes:
wagtail.contrib.modeladmin
is soon to be deprecated and so the Wagtail_modeladmin package has been used to continue supporting its featuresNote: The decision was made to use the modeladmin package instead of migrating to Snippets