openedx / openedx/openedx-core
Creating a new PublishableEntity should automatically create a row in Draft and Published
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10
- Forks
- 32
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 12
Description
NOTE: This is not ready for work yet -- see the note at the bottom.
In a recent PR, there was a need for code like this:
current_draft: Optional[Draft] = getattr(entity, "draft", None)
current_published: Optional[Published] = getattr(entity, "published", None)
This is because creating a new PublishableEntity does not populate these other models:
I think I originally wanted to distinguish between never published and published-but-since-unpublished. But now we have a whole PublishLog to track that.
Problem: The Published model actually has a non-nullable reference to a PublishLogRecord that points to how this particular version became the published version. If we initialize a Published entry to null, we would have to make this field nullable as well. Is that tradeoff worth it, or should we just make helpers on PublishableEntity to return the draft and published versions instead?
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.
Research direction
This issue is explicitly not ready for work. Start by reading openedx_learning/apps/authoring/publishing/api.py around lines 183-205, then inspect PublishableEntity, Draft, Published, and PublishLogRecord. Done means choosing between automatic rows and helper methods, documenting that decision, and updating the affected model/API behavior consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- api, backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100