Re: rendering modelForms

14 views
Skip to first unread message

kenneth gonsalves

unread,
Jul 9, 2012, 7:48:17 AM7/9/12
to django...@googlegroups.com
On Mon, 2012-07-09 at 04:27 -0700, mapapage wrote:
> In my django app I'm using modelForms and not simple django forms so
> in order to render the form I just do {{ form.as_table }} an the
> template and everything is being displayed. That's simple, but
> obviously any html code is being skipped, so I wonder how will I
> further customize my form (css stuff etc)+(I'd like to use twitter
> bootstrap) Is there any way? I also want to upload a file, but how am
> I going to add the required header <form method="post" action='./'{%
> if form.is_multipart %} enctype='multipart/form-data'{% endif %}>
> since my form is being automatically rendered only by
> {{ form.as_table }}? It confuses me.. can anyone help?

please paste your template
--
regards
Kenneth Gonsalves

mapapage

unread,
Jul 9, 2012, 8:40:04 AM7/9/12
to django...@googlegroups.com
 The important part of my template is the following:
<body>
    <h1>Forms</h1>
    
    {% extends "main.html" %}

    {% block content %}
    <form method="post" action='./'{% if form.is_multipart %} enctype='multipart/form-data'{% endif %}>

        {% csrf_token %}
       
        <table>
       
   {{ lname }}
   {{ fname }}
   {{ r_id }}
   
    {{ form.as_table }}

        </table>
        <input type="submit" value="Submit">
    </form>
    {% endblock %}


</body>
  
I really don't understand how am i going to gain control over each field of my form. 
Reply all
Reply to author
Forward
0 new messages