feat: Reorderable Task Definitions
Add the ability for users to define/modify order of ChecklistTaskDefinitions. This was achieved by introducing a generic OrderedModel
abstract class that can be inherited by models that want user defined ordering functionality.
This change contains 2 migrations:
- A migration introducing the new field
order
inChecklistTaskDefinition
from the new abstract classOrderedModel
, and changes the ordering in variousMeta
classes that depended on thecreated_on
field - A migration that populates the new field in existing
ChecklistTaskDefinition
based on thecreated_on
field to maintain the same ordering when migrating over to the new ordering system
Supporting information
Visual Changes
Dependencies
None
Merge deadline
None
Testing instructions
To try it out:
- Go to the admin page of a ChecklistDefinition
- Scroll down to the inline ChecklistDefinitionTasks
- Notice the new
Order
field - Change the number to match your desired ordering, smaller number is ranked/listed higher
- Save
- Refresh the Listaflow app to see the reflected changes on ordering
Author notes and concerns
There may seem to be arbitrary tests added in this merge request. The reason for that is, a big part of the new code is in a migration and django admin code, and hence there are no accompanied tests, so the coverage drops below the 95% limit (even though the I added tests for the new functionality). So I added a few more tests to go back above the limit. I'm open to suggestions for better ways to achieve this.
Edited by Yusuf Musleh