Skip to content

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

Open
KarenKawaii wants to merge 1 commit intovauxoo-dev:masterfrom
KarenKawaii:master-open-academy-states
Open

[IMP] openacademy: Set form fields to readonly based on workflow states#2
KarenKawaii wants to merge 1 commit intovauxoo-dev:masterfrom
KarenKawaii:master-open-academy-states

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