QS 0.9.1 PORD
This commit is contained in:
parent
23d2405838
commit
46fde71e6d
|
|
@ -43,6 +43,7 @@ import channels.layers
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from timemanagement.models import Workday
|
from timemanagement.models import Workday
|
||||||
import base64
|
import base64
|
||||||
|
import filetype
|
||||||
|
|
||||||
def randomString(stringLength=10):
|
def randomString(stringLength=10):
|
||||||
"""Generate a random string of fixed length """
|
"""Generate a random string of fixed length """
|
||||||
|
|
@ -745,13 +746,28 @@ def support(request):
|
||||||
attachments=[] #myfile is the key of a multi value dictionary, values are the uploaded files
|
attachments=[] #myfile is the key of a multi value dictionary, values are the uploaded files
|
||||||
for f in request.FILES.getlist('attachment_1'): #myfile is the name of your html file button
|
for f in request.FILES.getlist('attachment_1'): #myfile is the name of your html file button
|
||||||
filename = f.name
|
filename = f.name
|
||||||
attachments.append({str(filename) : str(base64.b64encode(f.read()))})
|
attachment_type = filetype.guess(f)
|
||||||
|
fileblob = str(base64.b64encode(f.read()))
|
||||||
|
fileblob = fileblob[1 : : ]
|
||||||
|
fileblob = fileblob[1 : : ]
|
||||||
|
fileblob = fileblob[:-1:]
|
||||||
|
attachments.append({str(filename) : "data:" + attachment_type.mime + ";base64," + fileblob})
|
||||||
for f in request.FILES.getlist('attachment_2'): #myfile is the name of your html file button
|
for f in request.FILES.getlist('attachment_2'): #myfile is the name of your html file button
|
||||||
filename = f.name
|
filename = f.name
|
||||||
attachments.append({str(filename) : str(base64.b64encode(f.read()))})
|
attachment_type = filetype.guess(f)
|
||||||
|
fileblob = str(base64.b64encode(f.read()))
|
||||||
|
fileblob = fileblob[1 : : ]
|
||||||
|
fileblob = fileblob[1 : : ]
|
||||||
|
fileblob = fileblob[:-1:]
|
||||||
|
attachments.append({str(filename) : "data:" + attachment_type.mime + ";base64," + fileblob})
|
||||||
for f in request.FILES.getlist('attachment_2'): #myfile is the name of your html file button
|
for f in request.FILES.getlist('attachment_2'): #myfile is the name of your html file button
|
||||||
filename = f.name
|
filename = f.name
|
||||||
attachments.append({str(filename) : str(base64.b64encode(f.read()))})
|
attachment_type = filetype.guess(f)
|
||||||
|
fileblob = str(base64.b64encode(f.read()))
|
||||||
|
fileblob = fileblob[1 : : ]
|
||||||
|
fileblob = fileblob[1 : : ]
|
||||||
|
fileblob = fileblob[:-1:]
|
||||||
|
attachments.append({str(filename) : "data:" + attachment_type.mime + ";base64," + fileblob})
|
||||||
|
|
||||||
#image = request.FILES
|
#image = request.FILES
|
||||||
supportdata = dict(form)
|
supportdata = dict(form)
|
||||||
|
|
@ -779,7 +795,8 @@ def support(request):
|
||||||
|
|
||||||
}
|
}
|
||||||
json_data = json.dumps(ostdata)
|
json_data = json.dumps(ostdata)
|
||||||
|
print(json_data)
|
||||||
|
'''
|
||||||
r = requests.post("https://support.vh-solutions.de/api/http.php/tickets.json", data=json_data, headers=headers)
|
r = requests.post("https://support.vh-solutions.de/api/http.php/tickets.json", data=json_data, headers=headers)
|
||||||
|
|
||||||
# IF request FAILED error-Message
|
# IF request FAILED error-Message
|
||||||
|
|
@ -787,7 +804,7 @@ def support(request):
|
||||||
messages.warning(request, f'Supportanfrage fehlgeschlagen!' + str(r))
|
messages.warning(request, f'Supportanfrage fehlgeschlagen!' + str(r))
|
||||||
else:
|
else:
|
||||||
messages.success(request, f'Supportanfrage erfolgreich! Ihre Ticketnummer ist '+ str(r.json()) +'!')
|
messages.success(request, f'Supportanfrage erfolgreich! Ihre Ticketnummer ist '+ str(r.json()) +'!')
|
||||||
|
'''
|
||||||
return render(request, 'users/support_done.html', context)
|
return render(request, 'users/support_done.html', context)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue