0

Ok so i have for example this field in my formModel

RItitle = models.CharField(max_length=100)

In my template:

            <tr>
                <th>RI Title </th><th>  {{ wizard.form.RItitle }} {{ wizard.form.RItitle.errors }}</th>
            </tr>

And now HTML :

<tr>
    <th>RI Title </th><th>  <input id="id_0-RItitle" type="text" name="0-RItitle" value="csss" maxlength="100"> </th>
            </tr>

How Can i change html options of this field ?? I mean for example style="width:150px" or sth like this . I cant use css example: .input{ width:150px;} coz i have more then 1 input in this form

Thanks for help

Silwest
  • 1,620
  • 1
  • 15
  • 29

1 Answers1

0

Styling should happen through CSS.

Because you have ID available, you can do it like this:

#id_0-RItitle {
    width: 150px;
    /* some other styles here */
}

For doing this programmaticaly, I would suggest using some CSS classes. To modify the widget used for displaying specific field (eg. by changing its class attribute and, if absolutely necessary, style attribute) follow the tips from this question: CSS styling in Django forms

Community
  • 1
  • 1
Tadeck
  • 132,510
  • 28
  • 152
  • 198
  • @Silwest: This is completely different question, about modification of specific widgets, not about styling. Please post it separately. – Tadeck Sep 18 '12 at 09:55