-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UDF to study and endpoint forms #906
Conversation
I think this needs a little more work - can this be updated and completed? I made a few edits in a scratch branch to get the conditional form logic working for the demo, but it may need to be added elsewhere too:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to get this one wrapped up! We can start here and then do the UDF tags next.
I haven't had time to do the work, but I did a code review of this PR and it's looking great so far. I think one thing we need to add is some caching mechanism to cache the UDF for each assessment, so we don't have as many database hits to see if each model type has a related UDF or not. It might be as simple as following a pattern similar to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a number of changes; see below. In general, try to generalize methods where possible; it's good that we had a Mixin for adding UDF on the detail view, but we needed the same thing to add to any Model Form; the way it was implemented as proposed required us to make lots of repetitive inline changes to each model form.
I also figured out how to auto-add the JS to the form pages; this was worth a read - Media.
- 10cb863 add tests
- 0a85e9d refactor content list
- 1f36963 refactor cache
- 518b4f5 bonus - improve type annotations for cacheable
- 780ef15 fix signals
- 6cc928d fix unique-together constraint
- 2fe1f62 fix table template layout
- b667ecb rename UDF table fragment
- 5534d61 add db constraint
- e445f72 load JS with DynamicForm or DynamicFormWidget
- 9a2f730 refactor common code into a form Mixin
- c242a7d reformat test html
ModelUDFContent