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 decimal field #43

Open
wants to merge 2 commits into
base: master
from
Open

Add decimal field #43

wants to merge 2 commits into from

Conversation

@kcrebound
Copy link
Contributor

@kcrebound kcrebound commented Jun 2, 2019

Simple draft of using the decimal field #42

I will be glad to continue after the discussion

kcrebound added 2 commits May 19, 2019
Update
@dopry
Copy link
Contributor

@dopry dopry commented Aug 27, 2019

Feature parity with Django is a goal and it should be easy for Django developers to adopt. We should at least keep a reference to Django if not use the DecimalField parameter naming. I do see wisdom, in keeping the parameter naming the same as the underlying SQLAlchemy implementation so we appeal to both developer communities.

Maybe adding doc strings would strike a balance and put us on a path to auto-generate more documentation.

"""  A fixed-precision decimal number field, 

A fixed-precision decimal number represented in Python by a Decimal instance.  It extends `Typesystem.Decimal`_

Args:
    scale (int):  the number of decimal places
    precision (int):  the maximum number of digits 

.. _Typesystem.Decimal:
  https://www.encode.io/typesystem/fields/#decimal
"""
@dopry
Copy link
Contributor

@dopry dopry commented Oct 10, 2019

@tomchristie I'd like your input here.

Django uses max_digits and decimal_places to define DecimalFields. SQL Alchemy and this PR use scale and precision, Typesystem uses precision internally.

I know you want to maintain Django compatibility to some extent. My gut says use scale and precision internally, but use kwargs instead of positional args to allow both sets of parameters and provide compatibility with both.

What would @tomchristie do?

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.