Skip to content
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

Add get_spmodel_class to replace getattr for Specify models, temp solution #5354

Open
wants to merge 1 commit into
base: production
Choose a base branch
from

Conversation

acwhite211
Copy link
Member

Fixes #5349

Avoid problems with getattr when getting model class names from Specify models due to capitalization differences. In order to maintain python class name readability, we create a utility function that can handling getting the class by name, even if the capitalization in the names don't match.

The get_spmodel_class functions is added in each file it is needed for now in order to avoid circular imports, I will make better in future.

Checklist

  • Self-review the PR after opening it to make sure the changes look good
    and self-explanatory (or properly documented)
  • Add automated tests
  • Add relevant issue to release milestone

Testing instructions

Open schema config
Choose one of the age table relativeAge - absoluteAge - absoluteAgeCitation, ...
Open uniqueness rule tool
Click add a rule
See crash

@@ -113,11 +113,23 @@
'Tectonicunittreedefitem': 'Tectonicunit'
}

def get_spmodel_class(model_name: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

the issue is not resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋Back Log
Development

Successfully merging this pull request may close these issues.

All ages tables throw error when opening uniqueness rules in Schema Config
2 participants