Opened 11 years ago

Closed 10 years ago

Last modified 7 years ago

#7333 closed (invalid)

newforms DecimalField docs different from class definition

Reported by: jfw Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The docs at
list max_decimal_places and max_whole_digits as parameters to DecimalField, whereas the actual class takes decimal_places, and nothing for max_whole_digits. The default_error_messages, however, do use those names, so that might be where the confusion comes from.

Attachments (1)

7333-suggestion.diff (3.2 KB) - added by Joshua Uziel 10 years ago.
A suggested fix to the issue.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by Sung-jin Hong

milestone: 1.0 alpha
Needs documentation: set
Triage Stage: UnreviewedAccepted

Confirmed. Needs documentation patch.

comment:2 Changed 10 years ago by ElliottM

milestone: 1.0 alpha1.0 beta
class DecimalField(Field):
214 	    default_error_messages = {
215 	        'invalid': _(u'Enter a number.'),
216 	        'max_value': _(u'Ensure this value is less than or equal to %s.'),
217 	        'min_value': _(u'Ensure this value is greater than or equal to %s.'),
218 	        'max_digits': _('Ensure that there are no more than %s digits in total.'),
219 	        'max_decimal_places': _('Ensure that there are no more than %s decimal places.'),
220 	        'max_whole_digits': _('Ensure that there are no more than %s digits before the decimal point.')
221 	    }
223 	    def __init__(self, max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs):
224 	        self.max_value, self.min_value = max_value, min_value
225 	        self.max_digits, self.decimal_places = max_digits, decimal_places
    * Error message keys: required, invalid, max_value, min_value, max_digits, max_decimal_places, max_whole_digits

Takes four optional arguments: max_value, min_value, max_digits, and decimal_places.

Am i Missing something? Those appear to match up. Also, this isn't related to a must-have feature, so i'm moving it out of 1.0 alpha

comment:3 Changed 10 years ago by Sung-jin Hong

Documentation is missing.

comment:4 Changed 10 years ago by Sung-jin Hong

Er.. ElliottM, you are right. I've misinterpreted the document. I think the issuer did the same mistake as me. Maybe we could redesign the document to migrate this problem?

Changed 10 years ago by Joshua Uziel

Attachment: 7333-suggestion.diff added

A suggested fix to the issue.

comment:5 Changed 10 years ago by Joshua Uziel

Attached a possible fix to the issue. Change "max_decimal_places" to "decimal_places" and "max_whole_digits" to "total_digits". Opinions?

comment:6 Changed 10 years ago by Malcolm Tredinnick

Make the docs match the code, not the other way around. That way you don't break any code that is already using these parameters.

comment:7 Changed 10 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

I can't see the problem here. As far as I can see, the docs match the implementation exactly, and according to SVN history, they always have.

comment:8 Changed 7 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

Note: See TracTickets for help on using tickets.
Back to Top