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

Min value should be Decimal #15413

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

Min value should be Decimal #15413

wants to merge 1 commit into from

Conversation

kdelee
Copy link
Member

@kdelee kdelee commented Jul 31, 2024

This hopefully resolves error message seen in logs sometimes about "should be Decimal type"

ISSUE TYPE

  • Bug, Docs Fix or other nominal change

COMPONENT NAME

  • API

Copy link

sonarcloud bot commented Jul 31, 2024

@@ -160,7 +160,7 @@ def __str__(self):
default=100,
editable=False,
)
capacity_adjustment = models.DecimalField(default=Decimal(1.0), max_digits=3, decimal_places=2, validators=[MinValueValidator(0)])
capacity_adjustment = models.DecimalField(default=Decimal(1.0), max_digits=3, decimal_places=2, validators=[MinValueValidator(Decimal(0.0))])
Copy link
Member

Choose a reason for hiding this comment

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

Does this not require a new migration file?

Copy link
Member Author

Choose a reason for hiding this comment

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

bash-5.1$ awx-manage makemigrations
No changes detected

Does not appear so

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't think it actually changes the datatype, but rather validator function in Django

Copy link
Member

Choose a reason for hiding this comment

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

validators had some weird place in both the fields and the model Meta. Weird but possible.

@AlanCoding
Copy link
Member

A test could be nice too.

This hopefully resolves error message seen in logs sometimes about "should be Decimal type"
Copy link

sonarcloud bot commented Sep 19, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants