html - How can you style/modify django file fields? -



html - How can you style/modify django file fields? -

in django (1.6) project, have form filefield uploading images (it filefield , not imagefield legacy reasons).

currently render form field in template doing {{ form.image }} renders label, link image, clearing checkbox , upload button. good, need style separate modules.

for url, i'd create render as:

<a href="url" class="fancybox" rel="group"> <img src="url" alt="product image" class="img-responsive"> </a>

and other parts (buttons, checkbox), want add together css classes them.

i looked @ clearablefileinput widged responsible rendering filefield , thinking maybe can accomplish overriding methods, not sure override alter little possible.

how can accomplish right way?

the widget accepts attrs parameter. it's dictionary passed along attributes on rendered html widget. here docs.

here's illustration docs class specified:

name = forms.textinput(attrs={'size': 10, 'title': 'your name', 'class': 'img-responsive'})

html css django

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -