def add_news(request):
    upload = NewsCreate()
    if (request.method == 'POST'):
        upload = NewsCreate(request.POST, request.FILES)
        if upload.is_valid():
            upload.save()
            return redirect('/admin-panel/news')
        else:
            return HttpResponse('your form is wrong, reload on <a href = "{{ url : \'/admin-panel/news\'}}">reload</a>')
    else:
        context = {'upload_form': upload, 'action': 'Добавить'}
        return render(request, 'add-news.html', context)
def add_news(request):
    upload = NewsCreate()
    if (request.method == 'POST'):
        upload = NewsCreate(request.POST, request.FILES)
        if upload.is_valid():
            upload.save()
            return redirect('/admin-panel/news')
        else:
            return HttpResponse('your form is wrong, reload on <a href = "{{ url : \'/admin-panel/news\'}}">reload</a>')
    else:
        context = {'upload_form': upload, 'action': 'Добавить'}
        return render(request, 'add-news.html', context)