Skip to content

Add configuration file for default values to populate e.g. status choices for different core applications #558

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

claire-peters
Copy link
Contributor

@claire-peters claire-peters commented Jul 31, 2023

I originally floated the idea of adding a new config file that would serve as a central reference list for all objects that are to be automatically added to the database in functions like add_allocation_defaults here. This PR is a follow-up on that. I included the default values for all apps with add_default commands in the config file, and then replaced the lists/tuples of those default values in the add_defaults commands with references to the config file.

There are a few ways I could see this config file being useful for other purposes, e.g., checking whether a given item is in the database in a given view.

'No',
'Attribute Expanded Text'
),
'statuschoices': (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was considering adding comments to this file that indicate which default options are required for Coldfront to function - e.g., the "Active" status choice is so ubiquitous in the codebase that removing it as a default would require a lot of changes.

'Float',
'Int',
'Text',
'Yes/No',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a side note, but I've been curious about why yes/no is used here instead of booleans and where the "no" option is more appropriate than "yes/no".

'projectuserstatuschoices': (
'Active', 'Pending - Add', 'Pending - Remove', 'Denied', 'Removed'
),
# in utils.add_project_user_status_choices, projectuserstatuschoices are ['Active', 'Pending Remove', 'Denied', 'Removed'].
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Left this question in the code. I didn't find "Pending Remove" in the code anywhere so I think I chose the correct options.

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.

1 participant