def test_course_form_rejects_invalid_data(self): form = CourseForm(self.bad_data) self.assertFalse(form.is_valid()) # def test_course_form_rejects_invalid_data(self): # form = CourseForm(self.bad_data) # self.assertFalse(form.is_valid())
def course_list(request): course_info = Course.objects.all() if request.method == 'POST': form = CourseForm(request.POST) if form.is_valid(): new_course = form.save(commit=False) new_course = form.save() else: form = CourseForm() return render_to_response('courses.html',{'courses': course_info, 'form': form},context_instance=RequestContext(request))
def test_course_form_accepts_valid_data(self): form = CourseForm(self.data) self.assertTrue(form.is_valid())