Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#7333 closed (invalid)

newforms DecimalField docs different from class definition

Reported by: jfw Owned by: nobody
Component: Documentation Version: dev
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

Description

The docs at http://www.djangoproject.com/documentation/newforms/#decimalfield
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 16 years ago.
A suggested fix to the issue.

Download all attachments as: .zip

Change History (9)

comment:1 by Sung-jin Hong, 16 years ago

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

Confirmed. Needs documentation patch.

comment:2 by ElliottM, 16 years ago

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 	    }
222 	
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 by Sung-jin Hong, 16 years ago

Documentation is missing.

comment:4 by Sung-jin Hong, 16 years ago

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?

by Joshua Uziel, 16 years ago

Attachment: 7333-suggestion.diff added

A suggested fix to the issue.

comment:5 by Joshua Uziel, 16 years ago

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

comment:6 by Malcolm Tredinnick, 16 years ago

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 by Russell Keith-Magee, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

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