Skip to content

feature: selectoptions can now be ordered.#216

Open
RoordinkFrank wants to merge 4 commits intodevelopfrom
feature/determine-order-of-selectoptions
Open

feature: selectoptions can now be ordered.#216
RoordinkFrank wants to merge 4 commits intodevelopfrom
feature/determine-order-of-selectoptions

Conversation

@RoordinkFrank
Copy link
Copy Markdown
Contributor

@RoordinkFrank RoordinkFrank commented Apr 2, 2026

fixes #174

Forms.py is slowly getting more duplicate code. I don´t think this can be easily changed but perhaps something to look into after the MVP.

@RoordinkFrank RoordinkFrank linked an issue Apr 2, 2026 that may be closed by this pull request
@RoordinkFrank RoordinkFrank marked this pull request as ready for review April 2, 2026 14:09
@RoordinkFrank
Copy link
Copy Markdown
Contributor Author

I did just now notice load_fixtures does not work anymore.
image

I am not sure if load_fixtures should be changed or the select option. Is is supposed to be nullable? I don´t think so?

Copy link
Copy Markdown
Contributor

@XanderVertegaal XanderVertegaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well!

As you mentioned, some parts of the code that are now duplicated (conversion of str -> list[int], making sure that all IDs exist) could be outfactored to reusable functions to make things a bit more DRY, but you may leave that for another PR if desired.

Comment thread backend/form/forms.py


class SelectQuestionAdminForm(ModelForm):
options_order = CharField(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer option_order, to keep things in line with substep_order and question_order. Make sure to also change this in admin.py.

Comment thread backend/form/forms.py

# Validate that the provided IDs exist.
available_ids = [question.id for question in self.instance.options.all()]
# In instance.NAME.all(), NAME is the verbose name.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment belongs to the line above it. I also think you mean related name when you say verbose name (which is something else).

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.

Determine order of SelectOptions

2 participants