|
@@ -4,15 +4,17 @@ from django.http import HttpResponseRedirect
|
|
from design_template.utils import handle_uploaded_file
|
|
from design_template.utils import handle_uploaded_file
|
|
from design_template.forms import ColorsForm, LogoForm
|
|
from design_template.forms import ColorsForm, LogoForm
|
|
from core import settings
|
|
from core import settings
|
|
|
|
+import subprocess
|
|
|
|
|
|
def upload(request):
|
|
def upload(request):
|
|
if request.method == 'POST':
|
|
if request.method == 'POST':
|
|
form = LogoForm(request.POST, request.FILES)
|
|
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. Please run command collectstatic")
|
|
|
|
|
|
+ if form.is_valid():
|
|
|
|
+ settings.NAME_SYSTEM = request.POST.get('namesystem')
|
|
|
|
+ handle_uploaded_file(request.FILES.get('logo'))
|
|
|
|
+ form.save()
|
|
|
|
+ subprocess.run(["/root/sharix-open-webapp-base/bin/collectstatic.sh"])
|
|
|
|
+ messages.success(request, "The logo has been uploaded successfully.")
|
|
return HttpResponseRedirect("/admin")
|
|
return HttpResponseRedirect("/admin")
|
|
else:
|
|
else:
|
|
form = LogoForm()
|
|
form = LogoForm()
|
|
@@ -77,7 +79,8 @@ a{{
|
|
'''
|
|
'''
|
|
with open("design_template/static/design_template/colors.css", 'r+', encoding='utf-8') as file:
|
|
with open("design_template/static/design_template/colors.css", 'r+', encoding='utf-8') as file:
|
|
file.write(css)
|
|
file.write(css)
|
|
- messages.success(request, "The colors changed successfully. Please run command collectstatic")
|
|
|
|
|
|
+ subprocess.run(["/root/sharix-open-webapp-base/bin/collectstatic.sh"])
|
|
|
|
+ messages.success(request, "The colors changed successfully.")
|
|
else:
|
|
else:
|
|
form = ColorsForm()
|
|
form = ColorsForm()
|
|
return render(request,"admin/change_colors.html", {'form':form})
|
|
return render(request,"admin/change_colors.html", {'form':form})
|