-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feat: add CalFresh option #1958
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
be7b2a4
to
55fd9bb
Compare
resolved discussion: Unexpected behavior with the ordering of benefit optionsIn dc62f35, I added the CalFresh eligibility type and verifier as new fixtures and set their When setting the references on a transit agency, I added the CalFresh eligibility type and verifier to be second in the list assuming / hoping that somehow Django would preserve the declaration order. We want CalFresh to be the second item when the app retrieves the verifiers for the eligibility selection form. However, launching the app locally, I see that is not the case: The eligibility selection form queries for the options using This makes sense because ultimately what gets put in the database are just rows in the junction tables The admin interface makes it even more obvious that there's no "declaration order"; you can multi-select, but the order is clearly fixed. I propose we add a |
the CalFresh objects were added to our fixtures in a way similar to how they would be added to the database via the admin interface. namely, they were added as objects that have an incremented ID in their respective tables.
use `django-admin-sortable2` to handle updating / editing.
55fd9bb
to
09be83e
Compare
@thekaveman and I discussed #1958 (comment) and agreed that the solution must include a good user experience for editing the order. This led to finding jrief/django-admin-sortable2, which allows for maintaining ordering on whatever models you choose and for editing that order using drag-and-drop in the Django admin site. We are following the approach described by these sections: Alternatives consideredThe approach described by Make stacked and tabular inlines sortable is for a one-to-many relationship and therefore not applicable to our TransitAgency and EligibilityVerifier models. The approach described by Sortable Many-to-Many Relations with Sortable Inlines is applicable, but we decided against it because it was getting complex: we'd need to use a custom |
Re: new ordering functionality, I don't think there are any unit tests to add here since all we're doing is adding a |
benefits/eligibility/templates/eligibility/includes/selection-label--calfresh.html
Outdated
Show resolved
Hide resolved
no refactor to modal-trigger needed
this is to prepare for Spanish translations that are coming later
Ready for re-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I love the graphical re-ordering capability within the Admin!
Closes #1915 and #1918
This PR adds the radio button option for "CalFresh Cardholders" to the eligibility index. The description contains a link that opens a help modal about CalFresh Cardholder eligibility.
Screenshots
To test verifier ordering
Steps for setting up to test
From existing database
will run migrations, including a migration that sets the initial display order for your existing verifiers.
From scratch
will recreate your database, run migrations, and load fixtures which define the values for
display_order
(since fixtures are loaded after migrations).Steps for testing
Start your local app, and log into your local admin interface to edit the order of your
Eligibility verifiers
by drag-and-drop.The radio buttons on the eligibility index should be in the order you specified.