from django.shortcuts import render from django.contrib import messages from django.http import HttpResponseRedirect from design_template.utils import handle_uploaded_file from design_template.forms import LogoForm from core import settings def upload(request): if request.method == 'POST': form = LogoForm(request.POST, request.FILES) if form.is_valid(): name_system = request.POST['namesystem'] settings.NAME_SYSTEM = name_system handle_uploaded_file(request.FILES['logo']) messages.success(request, "The logo has been uploaded successfully.") return HttpResponseRedirect("/admin") else: form = LogoForm() return render(request,"admin/upload_logo.html",{'form':form})