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

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Min value should be Decimal #15413

merged 1 commit into from
Dec 17, 2024

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

@@ -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.

@kdelee kdelee force-pushed the min-value-decimal branch 2 times, most recently from 20a1df2 to 9ee487d Compare September 24, 2024 16:46
Copy link

This hopefully resolves error message seen in logs sometimes about "should be Decimal type"
@AlanCoding AlanCoding merged commit 29f3679 into devel Dec 17, 2024
26 checks passed
@AlanCoding AlanCoding deleted the min-value-decimal branch December 17, 2024 17:45
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.

None yet

2 participants