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

Adding custom admin panels for news and updates #1200

Merged
merged 2 commits into from
Aug 16, 2017

Conversation

noahmanger
Copy link

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:
image

Each one of those takes you to a view that is default sorted by the original date of the item:
image

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.

@codecov-io
Copy link

codecov-io commented Aug 15, 2017

Codecov Report

Merging #1200 into release/public-20170811 will increase coverage by 1.05%.
The diff coverage is 94.44%.

Impacted file tree graph

@@                    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
Impacted Files Coverage Δ
fec/home/wagtail_hooks.py 95.55% <94.44%> (+6.08%) ⬆️
fec/home/models.py 87.29% <0%> (+1.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2dff2b8...3e99ea1. Read the comment docs.

Copy link
Contributor

@ccostino ccostino left a 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.

modeladmin_register(PressReleaseModelAdmin)
modeladmin_register(DigestPageModelAdmin)
modeladmin_register(TipsForTreasurersPageModelAdmin)
modeladmin_register(RecordPageModelAdmin)
Copy link
Contributor

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:

screen shot 2017-08-16 at 1 03 18 am

Where as if you just keep the one below, they go away and you have just the one menu item. :-)

@noahmanger
Copy link
Author

Good catch! I made that fix earlier but apparently forgot to push it. There it is.

Copy link
Contributor

@ccostino ccostino left a 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! :-)

@ccostino ccostino merged commit db6f035 into release/public-20170811 Aug 16, 2017
@ccostino ccostino deleted the news-and-updates-admin branch August 16, 2017 16:55
@dorothyyeager
Copy link
Contributor

Thank you @ccostino @noahmanger

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

Successfully merging this pull request may close these issues.

4 participants