The following is derived from an old post but I can not seem to get the 
button to render in the way that I want it to.....

Any help?

I am trying implement bootstrap on an upload button that is on the webpage.

class DocumentForm(forms.Form):
    docfile = forms.FileField(label='Select file')
    helper = FormHelper()
    helper.form_class = 'form-horizontal'
    helper.layout = Layout(
        Div(
        HTML('<p>{{ form.docfile.label_tag }} {{ form.docfile.help_text 
}}</p>'),
            css_class='col-sm-4 col-md-9 col-lg-9',
         ),
       )

I have definitely downloaded crispy forms and installed it in "APPS" and 
loaded the tags onto the page correctly.

I just want to be able to set a simple "div" to the button nothing more.

My HTML is as follows:

   <form action="{% url "list" %}" method="POST" enctype="multipart/form-data">
    <tr>
        {% csrf_token %}
        <p>{{ form.non_field_errors|crispy }}</p>

        <p>{{ form.docfile.label_tag|crispy }} {{ form.docfile.help_text|crispy 
}}</p>

        <p>
            {{ form.docfile.errors|crispy }}
            {{ form.docfile|crispy }}
        </p>
    </tr>
   </form>

The error I'm getting is as follows:

    'unicode' object has no attribute 'field'

So overall I'm looking to be able to just assign a simple "div" to the 
upload button that I have created without perturbing the button's function.

Is there a way to do this via the ordinary tag?:

     { % crispy form %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20891221-3251-42d5-a6e0-b45d9f5a8190%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to