Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

form.as_table in django

form = EmailForm()
return render_to_response('books/send_mail.html', {'email_form': form})

When i am using form.as_table in my template, all the fields are getting rendered in the same line : (Email: Subject: Message: ).

How can i render these form fields in seperate lines using as_table. I dont want to use as_p or as_ul, because they do not have proper alignment.

like image 583
prateek Avatar asked Apr 29 '11 13:04

prateek


People also ask

What is form Is_valid () in django?

The is_valid() method is used to perform validation for each field of the form, it is defined in Django Form class. It returns True if data is valid and place all data into a cleaned_data attribute.

What does form AS_P mean in django?

{{ form.as_p }} – Render Django Forms as paragraph. {{ form.as_ul }} – Render Django Forms as list.

What is form form in django?

Django provides a Form class which is used to create HTML forms. It describes a form and how it works and appears. It is similar to the ModelForm class that creates a form by using the Model, but it does not require the Model.

What is form cleaned_data in django?

cleaned_data returns a dictionary of validated form input fields and their values, where string primary keys are returned as objects. form. data returns a dictionary of un-validated form input fields and their values in string format (i.e. not objects).


1 Answers

Did you wrap your form in table tags?

You can also use form.as_table to output table rows (you'll need to provide your own tags)

like image 151
arie Avatar answered Nov 05 '22 15:11

arie