Skip to content
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

[IMP] openacademy: Set form fields to readonly based on workflow states #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KarenKawaii
Copy link

@KarenKawaii KarenKawaii commented Aug 26, 2016

VX#5845

There are two options to do this:

  • Modifiying the view.
    • Adding the attrs readonly into the field that you want.
    • However, this only applies into the modified view.
  • Modifiying the fields in the model.
    • Adding a method that returns a dictionary with the attribute values for key-state, e.g., no_editable_states.
    • Then, add the attribute states=no_editable_states into the fields of your model.
      This is a better approach if you don't want to change the views one by one
      because your are modifying the model's fields.

There are two options to do this:
1. Modifiying the view.
  - Adding the attrs readonly into the field that you want.
However, this only applies into the modified view.

2. Modifiying the fields in the model.
  - Adding a method that returns a dictionary with the attribute values
    for key-state, e.g., no_editable_states.
  - Then, add the attribute states=no_editable_states into the fields of
    your model.
This is a better approach if you don't want to change the views one by one
because your are modifying the model's fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants