Skip to content

Integrated base class support for foreign keys #1499

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 2 commits into
base: filterer_streamlining
Choose a base branch
from

Conversation

hepcat72
Copy link
Collaborator

@hepcat72 hepcat72 commented Apr 4, 2025

Summary Change Description

Turned is_fk into an instance attribute of the BSTColumn class instead of a class attribute of the BSTBaseColumn class.

I realized that is_fk is not necessarily a characteristic exclusive to the planned BSTRelatedColumn. A regular Field column (i.e. BSTColumn) can have fields that are foreign keys and they can be linked whether or not we've defined a BSTRelatedColumn. The features that BSTRelatedColumn will allow is the specification of a display value instead of how a related model object happens to render in str context. Just note that the foreign key cannot be searched or sorted based on that string-context value. That's what defining a BSTRelatedColumn will provide.

Details:

  • Created a model utility method named is_key_field
  • Defaulted is_fk in the BSTBaseColumn as False if it is not set/defined.
  • Added doc strings to a bunch of model utility methods.
  • Added a class attribute named is_related to BSTBaseColumn and made searchable and sortable automatically defaulted based on whether the field was a foreign key.

Affected Issues/Pull Requests

Reviewer Notes/Requests

See comments in-line.

Checklist

This pull request will be merged once the following requirements are met. The
author and/or reviewers should uncheck any unmet requirements:

hepcat72 added 2 commits April 4, 2025 13:17
…d of a class attribute of the BSTBaseColumn class.

I realized that is_fk is not necessarily a charcteristic exclusive to the planned BSTRelatedColumn.  A regular Field column (i.e. BSTColumn) can have fields that are foreign keys and they can be linked whether or not we've defined a BSTRelatedColumn.  The features that BSTRelatedColumn will allow is the specification of a display value instead of how a related model object happens to render in str context.  Just note that the foreign key cannot be searched or sorted based on that string-context value.  That's what defining a BSTRelatedColumn will provide.

Details:

- Created a model utility method named is_key_field
- Defaulted is_fk in the BSTBaseColumn as False if it is not set/defined.
- Added doc strings to a bunch of model utility methods.

Files checked in: DataRepo/models/utilities.py DataRepo/tests/views/models/bst_list_view/column/test_field.py DataRepo/views/models/bst_list_view/column/base.py DataRepo/views/models/bst_list_view/column/field.py
…archable and sortable automatically defaulted based on whether the field was a foreign key.

Files checked in: DataRepo/views/models/bst_list_view/column/base.py
@hepcat72 hepcat72 added type:feature New feature or request priority:2-high Must be implemented in order to meet release goals effort:4-under1day An issue that would take less than a day to complete component:views View classes/methods labels Apr 4, 2025
@hepcat72 hepcat72 self-assigned this Apr 4, 2025
Base automatically changed from bst_annot_col to filterer_streamlining June 3, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:views View classes/methods effort:4-under1day An issue that would take less than a day to complete priority:2-high Must be implemented in order to meet release goals type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant