tortoise / tortoise/tortoise-orm
Allow adding and removing m2m fields using id
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
The add() and remove() functions on the m2m field currently only accept instances of the related model.
It would be useful if it also accepted ids of the related model. This would avoid having to query the database to fetch the instances just to add or remove them.
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
Start by tracing the m2m field's add() and remove() entry points and how they currently validate related-model instances. Confirm the expected behavior for related-model ids, including avoiding an instance-fetch query, and verify that both operations accept ids while retaining existing instance support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100