def image_new(request):
if request.method == "POST":
form = ImageForm(request.POST, request.FILES)
if form.is_valid():
image = form.save(commit=False)
image.author = request.user
image.created = Image.created
image.save()
return redirect('images.views.detail')
else:
form = ImageForm()
return render(request, 'images/image_new.html', {'form': form})