hmpf / easydmp

MIT License
7 stars 2 forks source link

Rename Question.optional to something better #102

Closed hmpf closed 3 years ago

hmpf commented 4 years ago

optional=False means "show the red dot in the frontend right of the question" and "check that the question is filled in". This is what "required" is used for on fields in Django.

But: Renaming to "required" means all logic needs to be flipped. This will need at a minimum one database migration. I foresee three: 1) one to add the new field, default set to True. 2) one to fill the new field with the opposite of what's in "optional", 3) one to remove the old field. The code that starts using the new field can be included with migration 2.

hmpf commented 4 years ago

I called "optional" "optional" in order to cut down on "not"'s everywhere:

if optional:
     return  # return early
..expensive things..
return  # return after doing expensive things

The word "optional" isn't visible to the end user anywhere, but is of course visible to the template designer and in the API.

hmpf commented 3 years ago

Since Section.obligatory has been renamed to Section.on_trunk, this is less needed. Closing.