Exemplo n.º 1
0
	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()) 
Exemplo n.º 2
0
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))
Exemplo n.º 3
0
	def test_course_form_accepts_valid_data(self):
		form = CourseForm(self.data)
		self.assertTrue(form.is_valid())