diff --git a/aircox/templates/aircox/base.html b/aircox/templates/aircox/base.html index 6316705..666983c 100644 --- a/aircox/templates/aircox/base.html +++ b/aircox/templates/aircox/base.html @@ -74,8 +74,9 @@ Usefull context: {% translate "Profile" %} - - + + {% endif %} {% endblock %} diff --git a/aircox/templates/aircox/episode_form.html b/aircox/templates/aircox/episode_form.html index 9eac5b9..7d9e57d 100644 --- a/aircox/templates/aircox/episode_form.html +++ b/aircox/templates/aircox/episode_form.html @@ -23,7 +23,6 @@ {{ form.as_table }} {% render_honeypot_field "website" %} -

diff --git a/aircox/templates/aircox/program_form.html b/aircox/templates/aircox/program_form.html index fc937c2..e3f9596 100644 --- a/aircox/templates/aircox/program_form.html +++ b/aircox/templates/aircox/program_form.html @@ -6,6 +6,7 @@ {{ form.media }} {% endblock %} +{# FIXME: why disabling application init? #} {% block init-scripts %} {% endblock %} @@ -16,12 +17,23 @@
{% csrf_token %} - - {{ form.as_table }} - {% render_honeypot_field "website" %} -
-
- + {% csrf_token %} + {% for field in form %} +
+ +
{{ field }}
+
+ {% if field.errors %} +

{{ field.errors }}

+ {% endif %} + {% if field.help_text %} +

{{ field.help_text|safe }}

+ {% endif %} + {% endfor %} + +
+ +
diff --git a/dev-1.0-121-notes.md b/dev-1.0-121-notes.md index 775b69d..e77456b 100644 --- a/dev-1.0-121-notes.md +++ b/dev-1.0-121-notes.md @@ -3,3 +3,13 @@ - don't forget to add your exported module member name to __all__ ;) - it is better to put forms inside aircox.forms submodule (as aircox.forms.program subfiles, etc. if the file is to big + reexport in aircox.forms.__init__) - you can eventually regroup urls under "/admin" or sth like this, in order to avoid mixing public and backoffice urls. +- you can use fontawesome icons instead of UTF-8 ones (=> Editer sur la page d'émission, etc.): https://fontawesome.com/icons?d=gallery&m=free +- Forms: + - tables should not be used to render forms: either use flexbox or stack vertically labels and inputs. Generally, tables are in used to render data sets in modern web dev.; + - CSS framework partially use Bulma's ones (https://bulma.io/documentation/form/general/ ). You can customize form rendering by iterating over fields (example: aircox/templates/aircox/page_detail.html => comment form; no need for honeypot if user is authenticated) + - you can use template inheritance and inclusion in order to avoid repeating the code over all templates. If required you can just have base template as "page_form.html" that you can even set directly to your view classes if nothing specific is required for the model (on view class => template_name attribute). Less code = less bugs = less maintenance. + - btw some templates *_form extends from different base template. + - also, for submit button, just use class "button" (for color panel coherency). For secondary buttons, there is the css class "secondary" (as in `