-
Notifications
You must be signed in to change notification settings - Fork 26
Story 2412: Sign Up Page Integration #2482
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
base: develop
Are you sure you want to change the base?
Changes from 9 commits
2c65f7c
63fd563
ef5268a
4c57ebc
aa2b119
29dcc1b
0d96767
c6194c2
347d59e
da6bb83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -114,13 +114,12 @@ class CalendarView(V3Mixin, TemplateView): | |||||||||||||||||||
| v3_template_name = "v3/calendar.html" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| def get_context_data(self, **kwargs): | ||||||||||||||||||||
| ctx = super().get_context_data(**kwargs) | ||||||||||||||||||||
| ctx = {} | ||||||||||||||||||||
| ctx["boost_calendar"] = settings.BOOST_CALENDAR | ||||||||||||||||||||
| return ctx | ||||||||||||||||||||
|
Comment on lines
116
to
119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't bypass Starting from Suggested fix def get_context_data(self, **kwargs):
- ctx = {}
+ ctx = super().get_context_data(**kwargs)
ctx["boost_calendar"] = settings.BOOST_CALENDAR
return ctx📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| def get_v3_context_data(self, **kwargs): | ||||||||||||||||||||
| ctx = super().get_v3_context_data(**kwargs) | ||||||||||||||||||||
| print(self.request.headers) | ||||||||||||||||||||
| ctx["timezone"] = "America/Chicago" | ||||||||||||||||||||
| return ctx | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -502,7 +501,7 @@ class LearnPageView(V3Mixin, TemplateView): | |||||||||||||||||||
| v3_template_name = "v3/learn_page.html" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| def get_v3_context_data(self, **kwargs): | ||||||||||||||||||||
| ctx = self.get_context_data(**kwargs) | ||||||||||||||||||||
| ctx = super().get_v3_context_data(**kwargs) | ||||||||||||||||||||
| ctx["learn_card_data"] = [ | ||||||||||||||||||||
| { | ||||||||||||||||||||
| "title": "I want to learn:", | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -125,7 +125,10 @@ class LibraryListBase(BoostVersionMixin, V3Mixin, VersionAlertMixin, ListView): | |||||||||||||||||||||||
| v3_template_name = "v3/library_page.html" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def get_v3_context_data(self, queryset=None, **kwargs): | ||||||||||||||||||||||||
| context = {} | ||||||||||||||||||||||||
| queryset = self.get_queryset() | ||||||||||||||||||||||||
| context = super().get_v3_context_data( | ||||||||||||||||||||||||
| **kwargs, object_list=queryset, queryset=queryset | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
Comment on lines
127
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reuse the resolved list queryset instead of calling
Suggested fix def get_v3_context_data(self, queryset=None, **kwargs):
- queryset = self.get_queryset()
+ queryset = queryset if queryset is not None else self.object_list
context = super().get_v3_context_data(
**kwargs, object_list=queryset, queryset=queryset
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| view_str = self.kwargs.get("library_view_str") | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| cpp_options = [("all", "All")] + list( | ||||||||||||||||||||||||
|
|
@@ -258,16 +261,6 @@ def get_v3_context_data(self, queryset=None, **kwargs): | |||||||||||||||||||||||
| context["library_search_query"] = self.request.GET.get("q", "") | ||||||||||||||||||||||||
| return context | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def render_v3_response(self): | ||||||||||||||||||||||||
| """Render the v3 template through Django's standard TemplateView pipeline.""" | ||||||||||||||||||||||||
| queryset = self.get_queryset() | ||||||||||||||||||||||||
| # Resolve selected_version once so get_v3_context_data can reuse it. | ||||||||||||||||||||||||
| self._selected_version = self._resolve_selected_version() | ||||||||||||||||||||||||
| context = self.get_context_data( | ||||||||||||||||||||||||
| **self.get_v3_context_data(queryset=queryset), object_list=queryset | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| return self.render_to_response(context) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def _resolve_selected_version(self): | ||||||||||||||||||||||||
| version_slug = determine_selected_boost_version( | ||||||||||||||||||||||||
| self.kwargs.get("version_slug"), self.request | ||||||||||||||||||||||||
|
|
@@ -326,8 +319,10 @@ def get_categories(self, version=None): | |||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def dispatch(self, request, *args, **kwargs): | ||||||||||||||||||||||||
| """Set the selected version in the cookies.""" | ||||||||||||||||||||||||
| # Resolve selected_version once so get_v3_context_data can reuse it. | ||||||||||||||||||||||||
| self._selected_version = self._resolve_selected_version() | ||||||||||||||||||||||||
| response = super().dispatch(request, *args, **kwargs) | ||||||||||||||||||||||||
| """Set the selected version in the cookies.""" | ||||||||||||||||||||||||
| set_selected_boost_version(self.kwargs.get("version_slug"), response) | ||||||||||||||||||||||||
| view = get_prioritized_library_view(request) | ||||||||||||||||||||||||
| if request.resolver_match.view_name == "libraries": | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
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 bypasses existing
render_v3_response()overrides.Several supplied views still put real behavior in
render_v3_response()instead of only template selection — seecore/views.pyLine 135,news/views.pyLine 98, andlibraries/views.pyLine 462. After routing v3 requests straight throughsuper().dispatch(...), those code paths never run, so v3 requests silently lose their redirect/cookie/context setup. Either keep the hook inV3Mixin.dispatch()or migrate the remaining overrides in the same PR.🤖 Prompt for AI Agents