Story 2096: Implement Wagtail Integration#2100
Conversation
gregjkal
left a comment
There was a problem hiding this comment.
Per our conversation in standup: please test the homepage to make sure it won't break without manually migrating the existing testimonial and/or news items. If it does break, we need to either make these changes backwards-compatible (my strong preference!), with a follow-up change that cleans any bridge code up, or add a data migration so it can be fixed during the deploy instead of crashing until manual fixes.
julhoang
left a comment
There was a problem hiding this comment.
Hi @jlchilders11 ! This is awesome work! I just left a few of clarifying questions below.
Besides them, it looks like the HTML templates are now outdated. Do you have a next-step recommendation for us to update those templates to V3 versions? Also, do we need to update the V3 Create Post page and various other existing queries to query from Wagtail's PostPage instead of Entry?
Thanks so much for your work here!
| ] | ||
| page.save() | ||
| videos = Video.objects.all() | ||
| print(f"Creating or updating {news_posts.count()} Videos") |
There was a problem hiding this comment.
Nit: Should this be videos.count() instead?
There was a problem hiding this comment.
Is it the template for http://localhost:8000/pages/ ? It seems like this page just stay blank – would you mind helping me understand why we need this?
| + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | ||
| + [ | ||
| path("outreach/", include(wagtail_urls)), | ||
| path("pages/", include(wagtail_urls)), |
There was a problem hiding this comment.
Would you mind helping me understand why we need to route the /news path via /pages with Wagtail, instead of being able to navigate to it directly? It seems like we can navigate to http://localhost:8000/outreach/ directly, is it not possible to do the same with /news? Or is the idea here to have Wagtail lives on a separate prefix for development phase til we are ready to replace the legacy path? 🤔
|
|
||
| # Defines this as a home page | ||
| parent_page_types = ["wagtailcore.Page"] | ||
| # |
| class FlaggedMixin(Page): | ||
| def serve(self, request, *args, **kwargs): | ||
| if not waffle.flag_is_active(request, "v3"): | ||
| return HttpResponseForbidden("You do not have access to this page.") | ||
| return super().serve(request, *args, **kwargs) | ||
|
|
||
| class Meta: | ||
| abstract = True |
There was a problem hiding this comment.
Would it work if we use V3Mixin directly? 🤔
If not, can we return 404 when user doesn't have permission, so that they won't have a hint that this page exists?
a984bd7 to
bd274ee
Compare
Implement Wagtail Integrations:
Mixins
FlaggedMixin- Adds a custom serve method to prevent unflagged users from seeing this pageTaggableMixin- Adds the ability to tag pages for categorizationRouting
RoutableHomePage- New home page for all wagtail interactions that allows for forwarding routing to child pages, e.g. if you get to wagtail through/outreach/, you will be routed through theOutreachHomePagePosts
This is the bulk of the work, and is a porting of the existing
EntryModel to WagtailPostIndexPage- Index Page for Posts, implements most of the logic in formatting found in thenews.views.EntryListView. NOTE: this uses queryparams for filtering the child pages, rather than seperate URLsPostPage- Functional translation ofEntry, but uses a stream field rather than having separate models for different types of content. These can be filtered by the content of the stream field blockNOTES:
DEPLOYMENT NOTES:
When deploying this, a
RoutableHomePageshould be created and the existingOutreachHomePageshould be moved under it to respect the new routing methods.