From 9a22db5ae6eb8452aebfcf2c05fff96a3ab39f04 Mon Sep 17 00:00:00 2001 From: juliotoscano Date: Sat, 26 Nov 2016 19:34:55 -0300 Subject: [PATCH] form in exam template #362 --- exam/static/js/Exam.js | 7 ++++++- exam/templates/exam/create.html | 49 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/exam/static/js/Exam.js b/exam/static/js/Exam.js index 0c66336..bcee08d 100644 --- a/exam/static/js/Exam.js +++ b/exam/static/js/Exam.js @@ -122,4 +122,9 @@ function functionNewAlternativeTF(Question_Id){ $(Question_Id).append(element); $('.primary-label-TF').css('padding-left', '0px'); $.material.init() //O material deve ser iniciado aqui para funcionar os botoes de radio. -} \ No newline at end of file +} +var locale = navigator.language || navigator.userLanguage; + + $('.date-picker').datepicker({ + language: locale, + }); \ No newline at end of file diff --git a/exam/templates/exam/create.html b/exam/templates/exam/create.html index edee08b..339d7d1 100644 --- a/exam/templates/exam/create.html +++ b/exam/templates/exam/create.html @@ -13,22 +13,40 @@

{% trans "Create a Exam" %}

-
- -
- -
-
-
- -
- -
- -
- + {% csrf_token %} + {% for field in form %} + {% if field.auto_id != 'id_begin_exam' and field.auto_id != 'id_end_exam' and field.auto_id != 'id_begin_date' and field.auto_id != 'id_limit_date' %} +
+ {% if field.field.required %} + + {% else %} + + {% endif %} +
+ {% if field.auto_id == 'id_all_students' %} + {% render_field field class='form-control input-sm' %} + {% else %} + {% render_field field class='form-control input-sm' %} + {% endif %} +
+
+ {% endif %} + {% endfor %} +
+ {% for field in form %} + {% if field.auto_id == 'id_begin_date' or field.auto_id == 'id_limit_date' %} + {% if field.field.required %} + + {% else %} + + {% endif %} +
+ {% render_field field class='form-control date-picker' %} +
+ {% endif %} + {% endfor %}
-
+
@@ -38,6 +56,7 @@
+
-- libgit2 0.21.2