pallets-eco / pallets-eco/flask-admin
Inline editing and custom fields don't work
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.1k
- Forks
- 1.6k
- Avg merge
- 6d 14h
- Merged PRs (30d)
- 1
Description
Forgive me if there's already an issue active on this (or it's been resolved already) - I searched through the open issues and I could not find anything.
If you create a custom field, there's no way to specify that should be editable inline with other fields. In model/widgets.py in get_kwargs(), there's a hard coded list of field types supported. If you have a custom field type, there's no way it'll get picked up, and the Exception is raised here: https://github.com/flask-admin/flask-admin/blob/master/flask_admin/model/widgets.py#L161
There should be a way for you to somehow specify the kwargs for a custom field. I'm willing to draft the patch and submit a pull request, but wanted to check in to see if this was desired, and if so, the desired way. My initial solution is to just check to see if the subfield object has a callable function named get_inline_edit_kwargs(), and if it does, use that. Otherwise, it goes through the hard-coded list there.
Please let me know if this is something worth adding, or if you need any more details.
Thanks!
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 in model/widgets.py at get_kwargs() and inspect the hard-coded supported field types and the exception noted around line 161. Determine how custom field types can provide inline-edit kwargs, then verify that inline editing no longer rejects them; the issue names no test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100