use a for loop to go through fields, rather than hardcode just name, now it is used to edit authors too

This commit is contained in:
2020-12-05 19:22:14 +11:00
parent 4268b03ff6
commit 92fd582981

View File

@@ -1,6 +1,6 @@
{% extends "base.html" %} {% block main_content %} {% extends "base.html" %} {% block main_content %}
<div class="container"> <div class="container">
<h3><center>{{page_title}}</center></h3> <h3 class="offset-lg-2">{{page_title}}</h3>
{% if message|length %} {% if message|length %}
<div class="row alert alert-{{alert}}"> <div class="row alert alert-{{alert}}">
{{message}} {{message}}
@@ -8,12 +8,16 @@
{% endif %} {% endif %}
<div class="row"> <div class="row">
<form class="form form-inline col-xl-12" action="" method="POST"> <form class="form form-inline col-xl-12" action="" method="POST">
{{ form.id }} {% for field in form %}
{{ form.csrf_token }} {% if field.type == 'HiddenField' or field.type == 'CSRFTokenField' %}
{{field}}<br>
{% elif field.type != 'SubmitField' %}
<div class="form-row col-lg-12"> <div class="form-row col-lg-12">
{{ form.name.label( class="col-lg-2" ) }} {{ field.label( class="col-lg-2" ) }}
{{ form.name( class="form-control col-lg-2" ) }} {{ field( class="form-control col-lg-4" ) }}
</div class="form-row"> </div class="form-row col-lg-12">
{% endif %}
{% endfor %}
<div class="row col-lg-12"> <div class="row col-lg-12">
<br> <br>
</div class="row"> </div class="row">