Exemple #1
0
def new_arsenal(request):
	form = EntreeForm(data=request.POST)
	if form.is_valid():
		ars = Arsenal.objects.create()
		form.save(for_arsenal=ars)
		return redirect(ars)
	else:
		return render(request, 'home.html', {'form':form})
Exemple #2
0
	def test_form_validation_for_blank_entrees(self):
		form = EntreeForm(data={'name': ''})

		self.assertFalse(form.is_valid())
		self.assertEqual(form.errors['name'], [EMPTY_ENTREE_ERROR])