add errors to add-course form
authorSeth Woodworth <seth@sethish.com>
Wed, 27 Mar 2013 21:51:37 +0000 (17:51 -0400)
committerSeth Woodworth <seth@sethish.com>
Wed, 27 Mar 2013 21:51:37 +0000 (17:51 -0400)
karmaworld/templates/partial/add_course.html

index 7a6f5c329ba623f57dc7dec5f446e7870c0f4d39..7b65a58ed4cf9feeebc675251c9a7b12aa4caf20 100644 (file)
@@ -6,13 +6,25 @@
 <script src="{{ STATIC_URL }}js/lightbox-add-course.js"></script>
 
 <section id="add-course-form">
-  <form method="POST" action="{% url 'api_course_post' %}">
+  <form method="POST" action="{% url 'home' %}">
   {% csrf_token %}
 
+    <div class="row">
+      <div class="ten columns offset-by-one end">
+        {{ course_form.non_field.errors }}
+      </div>
+    </div>
+
+
     <div class="row">
       <div class="ten columns offset-by-one end">
         <legend>
           School
+         {% if course_form.school.errors %}
+          <span style="color:red">
+          * there was an error with this field
+          </span>
+         {% endif %}
         </legend>
         <div>
           <input id="str_school" class="" type="text" name="str_school"/>
 
     <div class="row">
       <div class="ten columns offset-by-one end">
-        <legend>Course Name: </legend>
+        <legend>Course Name: 
+          {% if course_form.name.errors %}
+            <span style="color:red">
+            * there was an error with this field
+            </span>
+          {% endif %}
+        </legend>
         <input id="id_name" class="" type="text" name="name" maxlength="255" />
       </div>
     </div> <!-- .row -->
       <div class="five columns offset-by-one">
         <legend class="">
           Instructor Name:
+          {% if course_form.instructor_name.errors %}
+            <span style="color:red">
+            * there was an error with this field
+            </span>
+          {% endif %}
         </legend><!-- -->
         <input id="id_instructor_name" class="" type="text" name="instructor_name" maxlength="75" />
       </div>
       <div class="five columns end">
         <legend class="">
           Instructor Email:
+          {% if course_form.instructor_email.errors %}
+            <span style="color:red">
+            * there was an error with this field
+            </span>
+          {% endif %}
         </legend>
         <input id="id_instructor_email" class="" type="text" name="instructor_email" maxlength="75" />
       </div><!--  -->
 
     <div class="row">
       <div class="ten columns offset-by-one end">
-        <legend>Course url:</legend>
+        <legend>Course url:
+          {% if course_form.url.errors %}
+            <span style="color:red">
+            * there was an error with this field
+            </span>
+          {% endif %}
+        </legend>
         <input id="id_url" class="" type="text" name="url" maxlength="255" />
       </div>
     </div> <!-- .row -->