QS 0.9.1 PORD

This commit is contained in:
Holger Trampe 2020-06-01 12:25:14 +02:00
parent 6c0c0b2217
commit 39053adeff
3 changed files with 8 additions and 9 deletions

1
.cred Normal file
View File

@ -0,0 +1 @@
https://holger.trampe:Zerogoogle123_@git.vhevents.de/

View File

@ -163,9 +163,9 @@ class SupportForm(forms.Form):
self.fields['problem'] = forms.CharField(required=True, widget=forms.Textarea, label="Ausführliche Problembeschreibung")
self.fields['name'].widget.attrs['readonly'] = True
self.fields['mail'].widget.attrs['readonly'] = True
self.fields["attachment_1"] = forms.FileField(label="Anhang 1", required=False)
self.fields["attachment_2"] = forms.FileField(label="Anhang 2", required=False)
self.fields["attachment_3"] = forms.FileField(label="Anhang 3", required=False)
#self.fields["attachment_1"] = forms.FileField(label="Anhang 1", required=False)
#self.fields["attachment_2"] = forms.FileField(label="Anhang 2", required=False)
#self.fields["attachment_3"] = forms.FileField(label="Anhang 3", required=False)
class NewAgencyForm(forms.Form):
def __init__(self, *args, **kwargs):

View File

@ -742,6 +742,7 @@ def support(request):
if request.method == 'POST':
form = request.POST
'''
fileblob = ""
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
@ -770,7 +771,7 @@ def support(request):
fileblob = fileblob[1 : : ]
fileblob = fileblob[:-1:]
attachments.append({str(filename) : "data:" + attachment_type.mime + ";base64," + fileblob})
'''
#image = request.FILES
supportdata = dict(form)
# Data from Form to JSON-Format
@ -779,8 +780,6 @@ def support(request):
problemconc = str(supportdata['problemconc'][0])
problem = str(supportdata['problem'][0])
# HEADERS CURL
headers = {'X-API-Key': 'F025A238EB74914E3653BA2989BFF7C4'}
subject = "Digitale Agentur: " + str(problemconc)
@ -792,13 +791,12 @@ def support(request):
"email": mail,
"subject": 'Digitale Agentur: '+problemconc,
"ip": "1.1.1.1",
"message": "*****************************\nAgentur: "+ request.user.profile.agency.name +" (ID: "+ str(request.user.profile.agency.pk) +")\nBenutzer: "+request.user.first_name+" "+request.user.last_name+" (ID: "+ str(request.user.pk) +")\n*******************************\n\n" + problem,
"attachments" : attachments
"message": "*****************************\nAgentur: "+ request.user.profile.agency.name +" (ID: "+ str(request.user.profile.agency.pk) +")\nBenutzer: "+request.user.first_name+" "+request.user.last_name+" (ID: "+ str(request.user.pk) +")\n*******************************\n\n" + problem
#"attachments" : attachments
}
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