Skip to content

Commit 5c19680

Browse files
OpenStaxClaudeclaudeCopilotmwvolo
authored
Add Wagtail admin interface for Donation Popup and Fundraiser models (#1662)
* Add Wagtail admin interface for Donation Popup and Fundraiser models This change makes the DonationPopup and Fundraiser models editable through the Wagtail admin interface, allowing content managers to update donation popup content without needing access to the Django admin. Changes: - Created donations/wagtail_hooks.py - Registered DonationPopup model with appropriate fields displayed - Registered Fundraiser model with appropriate fields displayed - Models remain accessible via Django admin for backward compatibility Related to: CORE-1390 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Group site messaging models under expandable "Site Messaging Modals" menu (#1663) * Initial plan * Create Site Messaging Modals group with all four models Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com> * Update PR description with completed changes Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com> * Remove accidentally committed database file Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com> * Add trailing comma to items tuple for consistency Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com> * update label --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com> Co-authored-by: Michael Volo <volo@rice.edu> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com> Co-authored-by: Michael Volo <volo@rice.edu>
1 parent c583c31 commit 5c19680

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ openstax/settings/local.py
1717
*.bk
1818
.vscode/settings.json
1919
.env
20+
db.sqlite3

donations/wagtail_hooks.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from wagtail_modeladmin.options import ModelAdmin, ModelAdminGroup, modeladmin_register
2+
from .models import DonationPopup, Fundraiser
3+
from global_settings.models import GiveToday, StickyNote
4+
5+
6+
class DonationPopupAdmin(ModelAdmin):
7+
model = DonationPopup
8+
menu_icon = 'form'
9+
menu_label = 'Donation Popup'
10+
list_display = ('download_ready', 'header_title', 'hide_donation_popup')
11+
search_fields = ('header_title', 'header_subtitle', 'download_ready',)
12+
13+
14+
class FundraiserAdmin(ModelAdmin):
15+
model = Fundraiser
16+
menu_icon = 'site'
17+
menu_label = 'Fundraisers'
18+
list_display = ('headline', 'color_scheme', 'message_type', 'goal_amount', 'goal_time')
19+
search_fields = ('headline', 'message',)
20+
21+
22+
class GiveTodayAdmin(ModelAdmin):
23+
model = GiveToday
24+
menu_icon = 'date'
25+
menu_label = 'Give Today'
26+
list_display = ('give_link_text', 'start', 'expires')
27+
search_fields = ('give_link_text',)
28+
29+
30+
class StickyNoteAdmin(ModelAdmin):
31+
model = StickyNote
32+
menu_icon = 'doc-empty'
33+
menu_label = 'Sticky Note'
34+
list_display = ('header', 'start', 'expires', 'show_popup')
35+
search_fields = ('header', 'body',)
36+
37+
38+
class SiteMessagingModalsGroup(ModelAdminGroup):
39+
menu_label = 'Site Messaging'
40+
menu_icon = 'doc-full-inverse'
41+
menu_order = 600
42+
items = (DonationPopupAdmin, FundraiserAdmin, GiveTodayAdmin, StickyNoteAdmin,)
43+
44+
45+
modeladmin_register(SiteMessagingModalsGroup)

global_settings/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from wagtail.contrib.settings.models import BaseSiteSetting, register_setting
33

44

5-
@register_setting(icon='doc-empty')
65
class StickyNote(BaseSiteSetting):
76
start = models.DateTimeField(null=True, help_text="Set the start date to override the content of the Give Sticky. Set the header and body below to change.")
87
expires = models.DateTimeField(null=True, help_text="Set the date to expire overriding the content of the Give Sticky.")
@@ -38,7 +37,6 @@ class Meta:
3837
verbose_name = 'CloudFront Distribution'
3938

4039

41-
@register_setting(icon='date')
4240
class GiveToday(BaseSiteSetting):
4341
give_link_text = models.CharField(max_length=255)
4442
give_link = models.URLField("Give link", blank=True, help_text="URL to Rice Give page or something similar")

0 commit comments

Comments
 (0)