okpy / ok

ok.py supports programming projects by running tests, tracking progress, and assisting in debugging.
Apache License 2.0
333 stars 84 forks source link

When editing student or staff, default to their current role, not Student #1359

Closed pbitutsky closed 5 years ago

pbitutsky commented 5 years ago

This resolves #1358.

I've tried many different approaches to setting the Role select's value and nothing has worked except adding javascript. It is not ideal and I'm not proud of this PR, but it works.

ja5087 commented 5 years ago

You can pass in data via the WTForms constructor i.e.

form = forms.EnrollmentForm(role=enrollment.role)

That probably requires moving some code around and making sure the logic still works.

pbitutsky commented 5 years ago

@ja5087, I was not able to pass values through the constructor but found a better way to do this. Please see new changes.