예제 #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()) 
예제 #2
0
파일: views.py 프로젝트: RayFerr000/PLTL
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))
예제 #3
0
	def test_course_form_accepts_valid_data(self):
		form = CourseForm(self.data)
		self.assertTrue(form.is_valid())