form_choices doesn't work
See original GitHub issuecan_post = [(x.id, x.nickname) for x in
User.query.filter_by(role=USER_ROLES['admin'])]
form_args = dict(
author=dict(
default=User.query.filter_by(role=USER_ROLES['admin']).first()
))
form_choices = {'author': can_post}
Form choices are not updated. I validated that can_post is a list with only the admin users, yet all users still show on the dropdown. I also have another site with similar code that doesn’t work either.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Solved: Unable to match form choices to sharepoint list
I am trying to setup a Flow to pull responses from a MS Form response and post them to a sharepoint list. For...
Read more >Dynamic form choices not being displayed: DJANGO
The Django Form properties are static properties of the class, this means you can't set them dynamically (they are evaluated when the class ......
Read more >MultipartBodyLengthLimit is not working in ASP.NET Core ...
I am trying to upload a file with size more than 30 MB and its throwing the following exception: HTTP Error 404.13 -...
Read more >Changing Form Choices via API, need guidance
I need some guidance on updating question choices via the API. So far I have tried the following: I have succesfully retrieved the...
Read more >formOptions.onComplete = 'none' clears s.action - DataTables
Right, the form stays open and the fields are all editable, this behavior is working fine. The problem was that I couldn't click...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We should make the
query_factory
more prominent in the docs. It seems like a pretty common thing to do.In flask-admin, you can override query_factory with form_args to change the query used to get select field choices:
https://github.com/flask-admin/flask-admin/blob/master/examples/sqla/app2.py