-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs: Add documentation for toolbar get_object and set_object methods #8312
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
docs: Add documentation for toolbar get_object and set_object methods #8312
Conversation
Co-authored-by: fsbraun <[email protected]>
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.
@copilot Can you reference the PageContent and PlaceholderRelationshipField docs using sphinx' :class:
syntax
@copilot Pleas consider the changes above. Also, add a description of both methods get_object and set_object to the documentation in chapter docs/how_to/01-placeholders.html |
…lder documentation - Changed references to be more specific (PageContent instead of Page) - Added Sphinx cross-references for PageContent and PlaceholderRelationField - Added comprehensive documentation section for get_object and set_object methods in docs/how_to/01-placeholders.rst Co-authored-by: fsbraun <[email protected]>
Added Sphinx :class: syntax for both PageContent and PlaceholderRelationField references. Updated in commit f6dab9d.
Applied all the suggested changes and added a new "Toolbar Object Management" section to docs/how_to/01-placeholders.rst that documents both get_object and set_object methods with proper Sphinx cross-references. Updated in commit f6dab9d. |
@copilot Include the content of lines 133ff into the new documentation section "Toolbar object management". Add examples for usage in views and templates along the line: In views sse the toolbar's get_object() method:
It works similarly inside a template: {{ request.toolbar.get_object.title }} or
Adjust the examples to the context. Improve the new section's title to something along "Setting and getting the placeholder-enabled object from the toolbar" |
…amples Co-authored-by: fsbraun <[email protected]>
Updated the documentation section as requested:
The documentation now provides a complete guide for developers working with toolbar object management, including practical examples for both server-side and template usage. Updated in commit 1841dbb. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8312 +/- ##
=======================================
Coverage 89.60% 89.60%
=======================================
Files 129 129
Lines 12710 12710
=======================================
Hits 11389 11389
Misses 1321 1321 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Looks good to me. Let's get this merged and released 🚢 🚀
This PR adds comprehensive documentation for the
get_object
andset_object
methods in theCMSToolbarBase
class, which were previously undocumented. Fixes #8311Changes Made
Toolbar Method Documentation
Added detailed docstrings for both methods in
cms/toolbar/toolbar.py
:set_object(obj)
: Documents how this method associates a Django model instance with the toolbar, explaining that it only sets the object if one hasn't already been setget_object()
: Documents how this method retrieves the currently associated object, returningNone
if no object has been setEnhanced Documentation Features
:class:
syntax forPageContent
andPlaceholderRelationField
:param
and:type
) and return value documentation (:returns
and:rtype
)get_object_edit_url
,get_object_preview_url
, andget_object_structure_url
Comprehensive User Guide Documentation
Added an enhanced "Setting and getting the placeholder-enabled object from the toolbar" section to
docs/how_to/01-placeholders.rst
that includes:set_object()
andget_object()
methods with proper Sphinx cross-references{% with %}
tag patterns:Impact
The documentation will automatically appear in the generated Sphinx documentation under the
CMSToolbar
class reference. The comprehensive user guide provides practical context for developers working with placeholders outside the CMS, showing real-world usage patterns for both server-side views and frontend templates.These methods are fundamental to the toolbar's object association functionality and enable proper integration of custom models with django CMS's frontend editing capabilities.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.