def index(request): author = Author() if request.method=='POST': # Formular wurde abgeschickt form = AuthorForm(request.POST, instance=author) if form.is_valid(): form.save() messages.success(request, u"Author saved successfully.") #return HttpResponseRedirect(reverse('wherever')) else: messages.error(request, u"Data incorrect.") pass else: form = AuthorForm(instance=author) template = loader.get_template('testapp/testpage.html') context = RequestContext(request, {'form':form}) return HttpResponse(template.render(context))
def setUp(self): super(ApproximateCountTests, self).setUp() Author.objects.bulk_create([Author() for i in range(10)])
def setUp(self): super(SmartIteratorTests, self).setUp() Author.objects.bulk_create([Author(id=i + 1) for i in range(10)])
def setUp(self): super(FoundRowsTests, self).setUp() Author.objects.bulk_create([Author() for i in range(10)])