-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add guidelines to document new filters
- Loading branch information
1 parent
c482c05
commit 489f0df
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Documenting Open edX Filters Classes | ||
==================================== | ||
|
||
When creating a new filter, you should document the purpose of the filter in the docstring of the filter class. This will help other developers understand the purpose of the filter and how to use it. | ||
|
||
The docstring should comply with the following guidelines: | ||
|
||
- The docstring should be a triple-quoted string. | ||
- The docstring should be placed at the beginning of the class definition. | ||
- The docstring should describe the purpose of the filter. | ||
- The docstring should include a brief description of what's supposed to do. | ||
- The docstring should include the filter type ``filter_type``, which is the unique identifier for the filter. | ||
- The docstring should include the trigger information, which includes the repository, path, and function or method that triggers the filter. | ||
- The docstring should include any other relevant information about the filter (e.g., it works only for legacy views not MFEs). | ||
|
||
Consider the following example: | ||
|
||
.. code-block:: python | ||
class AccountSettingsRenderStarted(OpenEdxPublicFilter): | ||
""" | ||
Description: | ||
Filter used to modify the rendering of the account settings page in the LMS. | ||
This filter is triggered when a user visits the account settings page, just before the page is rendered allowing | ||
the filter to modify the context and the template used to render the page. | ||
Filter Type: | ||
org.openedx.learning.student.settings.render.started.v1 | ||
Trigger: | ||
- Repository: openedx/edx-platform | ||
- Path: openedx/core/djangoapps/user_api/accounts/settings_views.py | ||
- Function or Method: account_settings | ||
Additional Information: | ||
This filter doesn't work alongside the account MFE, only with the legacy account settings page. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ References | |
filters | ||
django-plugins-and-filters | ||
real-life-use-cases | ||
documenting-filters-classes |