-
Notifications
You must be signed in to change notification settings - Fork 12
changes to SingleOwnerMixin for Django-2.0 #10
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
base: master
Are you sure you want to change the base?
Changes from all commits
b2f9be7
42d172f
cb2e76b
926aa18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ def decimal_value(value): | |
return value | ||
|
||
|
||
class Money(object): | ||
class Money(decimal.Decimal): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not the right solution to this problem. This class composes a money value from a Decimal amount and a currency it does not use inheritance. |
||
""" | ||
Represents a monetary quantity. | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ def get_db_prep_save(self, value, connection): | |
value = self.to_python(value) | ||
if value is not None: | ||
value = value._amount | ||
return connection.ops.value_to_db_decimal(value, self.max_digits, self.decimal_places) | ||
return connection.ops.adapt_decimalfield_value(value, self.max_digits, self.decimal_places) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change backwards compatible with Django < 2? This might require a conditional to handle previous Django releases There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, I don't know, as everything I'm doing now is Django 2+. But it seems that 'value_to_db_decimal' disappeared in Django 1.9 |
||
|
||
|
||
class PercentField(models.FloatField): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for null=True?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the only way 'makemigrations' would work for me; but perhaps there is a better way?