On Friday 05 May 2017 06:17:12 guettli wrote:
> Am Donnerstag, 4. Mai 2017 16:03:25 UTC+2 schrieb Todor Velichkov:
> > Take a look at:
> > 1) Form rendering options
> > <https://docs.djangoproject.com/en/1.11/topics/forms/#form-rendering
> > -options> 2) Outputting forms as HTML
> > <https://docs.djangoproject.com/en/1.11/ref/forms/api/#outputting-fo
> > rms-as-html>
> >
> > {{ form }} and {{ form.as_table }} are basically the same.
> > So in terms of valid markup <table>{{ form }}</table> would be more
> > correct.
>
> OK, <table>{{ form }}</table> is what I do now. Somehow I am unsure
> if this is really the best way.
There is never a best way. Only a best way for the job.
Django's job is to provide sensible, workable defaults. Table, paragraph and list view are 3 common ways to render form elements.
If you however use Bootstrap for css, you're much more helped by using the bootstrap3 package. Example:
<form method="POST">
{% csrf_token %}
{% bootstrap_form form %}
{% buttons submit='Go!' %}{% endbuttons%}
</form>
--
Melvyn Sopacua
No comments:
Post a Comment