On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote: > > Hello again -- > > I'm creating a form using form_for_model. The model in question has a > decimal field with 2 decimal places. The form, however, is displaying > the field with one decimal place. I've googled and poked through the > tests, but I can't figure out how to override this without creating an > entire custom form, which seems like overkill. I'm sure I'm missing > something, but... what?
1) This sounds like it could be a bug. If your model defines 2 decimal places, my initial reaction is that the form should show 2 decimal places by default. 2) You can override an individual element using the formfield_callback on form_for_model. The idea here is to provide a function that returns the form field when provided with a model field. The default implementation calls the formfield() method on the model field; If you want to use a different widget for just one field, you can provide an implementation for formfield_callback that overrides just one field. The newforms docs contain a description for how this works. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

