def upload_gr(request): """View to render upload form in Greek""" if request.method == 'POST': form = UploadForm(request.POST, request.FILES) if form.is_valid(): form.save() _send_upload(form) messages.info(request, 'Ευχαριστούμε. Η πρόταση σου εστάλη.') return redirect(reverse('gallery:upload_gr')) messages.error(request, 'Υπάρχουν κάποια λάθη στη φόρμα.') else: form = UploadForm() return render(request, 'gallery/upload_gr.html', {'form': form})
def upload(request): """View to render upload form""" if request.method == 'POST': form = UploadForm(request.POST, request.FILES) if form.is_valid(): form.save() _send_upload(form) messages.info(request, 'Thank you. Your submussion has been sent.') return redirect(reverse('gallery:upload')) messages.error(request, 'Please fix the errors on the submission form.') else: form = UploadForm() return render(request, 'gallery/upload.html', {'form': form})