From 39053adeff1441e9722911b12f758c4af493e732 Mon Sep 17 00:00:00 2001 From: Holger Trampe Date: Mon, 1 Jun 2020 12:25:14 +0200 Subject: [PATCH] QS 0.9.1 PORD --- .cred | 1 + users/usersforms.py | 6 +++--- users/views.py | 10 ++++------ 3 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 .cred diff --git a/.cred b/.cred new file mode 100644 index 0000000..26f9598 --- /dev/null +++ b/.cred @@ -0,0 +1 @@ +https://holger.trampe:Zerogoogle123_@git.vhevents.de/ diff --git a/users/usersforms.py b/users/usersforms.py index bc9ba65..c4d1997 100644 --- a/users/usersforms.py +++ b/users/usersforms.py @@ -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): diff --git a/users/views.py b/users/views.py index 7d40028..898ba2d 100644 --- a/users/views.py +++ b/users/views.py @@ -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