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 timemanagement.models import Workday
|
||||
import base64
|
||||
import filetype
|
||||
|
||||
def randomString(stringLength=10):
|
||||
"""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
|
||||
for f in request.FILES.getlist('attachment_1'): #myfile is the name of your html file button
|
||||
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
|
||||
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
|
||||
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
|
||||
supportdata = dict(form)
|
||||
|
|
@ -778,8 +794,9 @@ def support(request):
|
|||
"attachments" : attachments
|
||||
|
||||
}
|
||||
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)
|
||||
|
||||
# IF request FAILED error-Message
|
||||
|
|
@ -787,7 +804,7 @@ def support(request):
|
|||
messages.warning(request, f'Supportanfrage fehlgeschlagen!' + str(r))
|
||||
else:
|
||||
messages.success(request, f'Supportanfrage erfolgreich! Ihre Ticketnummer ist '+ str(r.json()) +'!')
|
||||
|
||||
'''
|
||||
return render(request, 'users/support_done.html', context)
|
||||
else:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue