def add_category(request): context = RequestContext(request) if request.method == 'POST': form = CategoryForm(request.POST, request.FILES) if form.is_valid() and form.is_multipart(): save_files(request.FILES['image']) form.save(commit=True) return index(request) else: print form.errors else: form = CategoryForm() return render_to_response('app/add_category.html', {'form': form}, context)
def addCategory(request): f = CategoryForm(request) f.save() return True