-
Notifications
You must be signed in to change notification settings - Fork 40
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
Adding custom admin panels for news and updates #1200
Conversation
Codecov Report
@@ Coverage Diff @@
## release/public-20170811 #1200 +/- ##
==========================================================
+ Coverage 64.15% 65.2% +1.05%
==========================================================
Files 186 186
Lines 5325 5541 +216
Branches 404 409 +5
==========================================================
+ Hits 3416 3613 +197
- Misses 1881 1899 +18
- Partials 28 29 +1
Continue to review full report at Codecov.
|
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.
This is awesome, @noahmanger, thank you!
I noticed one thing with the menu though, and I think it's just extraneous ModelAdmin
registration statements that aren't needed. I wanted to check and see if you experience the same behavior or not to verify whether the adjustment I recommended is needed.
fec/home/wagtail_hooks.py
Outdated
modeladmin_register(PressReleaseModelAdmin) | ||
modeladmin_register(DigestPageModelAdmin) | ||
modeladmin_register(TipsForTreasurersPageModelAdmin) | ||
modeladmin_register(RecordPageModelAdmin) |
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.
It looks like these are extra register
statements that aren't needed... you only need the last one for the menu itself to show up with the sub items in it. What I found was that with these statements in place, you see them in the main menu too:
Where as if you just keep the one below, they go away and you have just the one menu item. :-)
Good catch! I made that fix earlier but apparently forgot to push it. There it is. |
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.
Awesome, we're good to go! :-)
Thank you @ccostino @noahmanger |
This uses Wagtail's
ModelAdmin
hooks to implement custom admin panels for the latest updates.Now, there will be a new menu item for "News and updates", which contains links to each type of update:
Each one of those takes you to a view that is default sorted by the original date of the item:
I think this is actually a much better approach than the "Folder" concept earlier as it doesn't require any redirects or moving pages around.