openedx / openedx/openedx-core
Improve usability of created/created_by/set_at/set_by in the publishing API ?
@kdmccormick is already working on this.
Since Apr 24, 2026.
- Dominant language
- Python
- Stars
- 10
- Forks
- 32
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 12
Description
- If you call
create_publishable_entity, specifyingcreated(timestamp) andcreated_byis mandatory, and gets set directly on the newPublishableEntitymodel.- If you do this within a
bulk_draft_changes_for/DraftChangeLogContext, thechanged_at/changed_byfrom the context does not override thecreated/created_byspecified oncreate_publishable_entity(). Note also that simply creating an entity without any version does not affect the changelog nor create a change log record (expected).
- If you do this within a
- If you call
create_publishable_entity_version, specifyingcreated(timestamp) andcreated_byis mandatory.- If you do this within a
bulk_draft_changes_for/DraftChangeLogContext, thechanged_at/changed_byfrom the context overrides the thecreated/created_byspecified here. But you still have to specify it.
- If you do this within a
- If you call
soft_delete_draft, specifyingdeleted_by(user id) is optional, and specifying a timestamp is not possible.- If you do this within a
bulk_draft_changes_for/DraftChangeLogContext, thechanged_at/changed_byfrom the context overrides the thedeleted_byspecified here.
- If you do this within a
- If you call
reset_drafts_to_published, specifyingreset_at/reset_byis optional.- If you do this within a
bulk_draft_changes_for/DraftChangeLogContext, thechanged_at/changed_byfrom the context overrides them, and they are ignored.
- If you do this within a
- If you call
set_draft_versiondirectly, specifyingset_at/set_byis optional.- If you do this within a
bulk_draft_changes_for/DraftChangeLogContext, thereset_at/reset_byfrom the context overrides them, and they are ignored.
- If you do this within a
The Containers and Components APIs also often accept/require created/created_by arguments, which are sometimes mandatory and sometimes optional, and follow the same patterns as above.
The create_x_and_version APIs are generally structured so that the created timestamp is mandatory, passing it through the layers so that the X and XVersion both have the same created timestamp. The created_by is more likely to be optional because it will still be consistently None even if omitted at the top level.
When the user ID is optional, the API cannot detect/model the difference between "I forgot to specify the user" and "this is a system action with no associated user" - both use user_id=None.
Names of the timestamp variable: changed_at, created, reset_at, set_at
Names of the user ID variable: changed_by, created_by, reset_by, set_by, deleted_by
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.