-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Migrate from ModelAdmin to Snippets #472
Migrate from ModelAdmin to Snippets #472
Conversation
Hey @dkirkham, sorry for the delay in my response. I had planned to look at this during the weekend, but then got caught up with an unexpected tasks. I'll review your pull request first thing this Saturday. In the meanwhile, I also added @ababic as a reviewer. He's the original author and may offer a much more valuable insight than I could (if he is available, of course). |
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.
Well done, @dkirkham !
Code looks super tight. Couldn't find any issues. I've also trying migrating a few of my projects to this version and they have all worked without a hitch!
2 questions:
- Because this would be a major version upgrade, I about releasing as a
rc
version for now and then making the official release on February. Wagtail 4.1 support goes up to Feb 1st, so I think it makes sense if we officially moved to Wagtail 5.2 together. What do you think? - Do you think it makes sense to add a "Migrating" section to the docs. Basically, all one needs to do is to delete the
modeladmin
contrib packages, but it would put users at ease.
README.rst
Outdated
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.
You remembered to change the docs! Wonderful!
wagtailmenus/modeladmin.py
Outdated
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.
Comment: this might be a breaking change, but maybe it makes sense for use to rename this module snippets
. Or, if it breaks existing projects, add a comment for future maintainers understand these are, for all intents and purposes, what wagtail now understands as snippets.
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 was contemplating renaming this file to admin.py but wanted to keep the commit changeset more understandable. I can easily add this as an additional commit.
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.
@dkirkham / @MrCordeiro i think we can class this whole peice of work as a breaking change, because anyone extending these classes currently will likely need to do some refactoring to make their overriden behaviour compatible with snippets.
I would suggest maybe wagtailadmin.py
as the filename, just to distinguish it a little from admin.py
- which is usually where you find modeladmin classes for the Django admin.
Hi @MrCordeiro, thanks for the feedback and testing. Responding to your questions:
|
@@ -1,20 +1,57 @@ | |||
{% extends "modeladmin/create.html" %} | |||
{% extends "wagtailadmin/base.html" %} |
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.
@dkirkham is there a Snippet template we can extend here instead that would already do some of this stuff? It would be nice to only override blocks where needed, if possible.
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.
Hi @ababic, my intent was to override only blocks, but I couldn't find a way. The issue was finding a place for the mainmenu select: the only feasible area was within wagtailadmin/shared/header.html and only a limited context is passed there. If you can see a way, let me know.
If we removed the mainmenu select (which would change editor/admin workflow a bit) then I think we could avoid changing any templates, but I considered that sort of change out of scope for this PR.
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.
Thanks for the explanation. Now that FieldPanel has the read_only
option, I think we could get away with using that in the edit/create views to indicate the site, and perhaps only redirect straight to there in a single-site setup.
Any chance we can get this merged and released? Its blocking wagtail 6 upgrades. |
Yes I will take a look |
Sorry all, I've been a bit busy with other things over recent weeks. There is still some documentation to update, and now that Wagtail 6 is out, I'd like to see if we can get compatibility with that and 5.2 LTS. I'll be working on this later today. |
I've just added Wagtail 6.0 support - there were only a couple of changes as I had expected. I still need to test this within an existing project of mine, which I'll do tomorrow. @vbabiy, @schlich and others, have you tried this update in your projects, and have any issues arisen? If not, I think we are close to being able to do a release - just some doco to update. |
I will give this a quick test and let you know. |
I tested I did however encounter an issue during installation, it seems installing from github didn't reliably remove and change all the package files. I found I had to:
If
I'll start working on the documentation this Wednesday, unless someone else wants to start on it earlier. |
Worked with no issues for me as well. |
i'll take y'alls word on when this is ready to release and i can push the pypi button. @MrCordeiro if you have any reservations make 'em known! |
If all we're waiting on is docs i'm gonna go ahead and merge, we can merge the docs when theyre ready |
Made a follow-up issue for outstanding documentation ^^ clarifications welcome |
Opened a PR for a release candidate at #480 |
Fixes #459 for Wagtail >= 5.2.
This fairly large PR removes Wagtail
ModelAdmin
from thewagtailmenus
admin pages, replacing it with WagtailSnippets
.My approach has been keep as much of the existing
wagtailmenus
functionality as possible, and absolutely minimise the number of changes to the existing test suite. If functionality changes are desired, these should be discussed and designed accordingly and prepared as separate PRs.I have also only been targeting Wagtail 5.2 LTS, because earlier versions (particularly 4.1 LTS and 5.1) are supported by existing
wagtailmenus
releases, and are as a whole only in support for a couple more weeks anyway. That said, the tests appear to work for some earlier Wagtail releases, although I haven't yet validated whether the UI is fully functional. The tests also also work, excepting one HTML markup test, against the current github wagtail#main and that problem may just be a test setup issue.Given the changes are significant, and I would encourage any users of this package to test it within their overall projects before it is merged or released.
There are a few more things left to do, certainly before release, and the details here may depend on any real-life testing:
setup.py
file currently allows, and if it can be made wider, it will ease the migration