views:

251

answers:

1

I'm using django-uni-form to style my form using the filter my_form|as_uni_form:

<form class="uniForm" id="my_form" method="post" action="./">
      <fieldset class="inlineLabels">
           {{ my_form|as_uni_form }}
           <div  class="form_block">
                <input type="submit" value="Submit"/>
           </div>
       </fieldset>
</form>

It looks really good. But I need to customize it.

For example, one of the field "percentage" of the form is of the type IntegerField. It is being rendered as an <input type="text">. The problem is that the text box is really wide, I'd like to make it only 2 character wide. Also I want to add a percentage sign "%" right after the text box so that users know they if they put in the number "10" in the text box, it means 10%.

Is there anyway to do that with django-uni-form?

Thanks for your help.

A: 

You'll need to loop over the elements of your form and render the uniForm markup yourself. Either that, you can customize the look of each input based on an id or class.

What I'd do is look at the mark up it generates, and then loop over the elements generating that same markup and customize them. See the Django docs for more information.

Bialecki