## #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: | UI/UX: |

### 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)

### Change History (9)

### comment:1 Changed 8 years ago by

milestone: | → 1.0 alpha |
---|---|

Needs documentation: | set |

Triage Stage: | Unreviewed → Accepted |

### comment:2 Changed 8 years ago by

milestone: | 1.0 alpha → 1.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:4 Changed 8 years ago by

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?

### comment:5 Changed 8 years ago by

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 8 years ago by

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 8 years ago by

Resolution: | → invalid |
---|---|

Status: | new → closed |

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.

**Note:**See TracTickets for help on using tickets.

Confirmed. Needs documentation patch.