예제 #1
0
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})
예제 #2
0
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})