QS 0.9.1 PORD
This commit is contained in:
parent
6c0c0b2217
commit
39053adeff
|
|
@ -163,9 +163,9 @@ class SupportForm(forms.Form):
|
||||||
self.fields['problem'] = forms.CharField(required=True, widget=forms.Textarea, label="Ausführliche Problembeschreibung")
|
self.fields['problem'] = forms.CharField(required=True, widget=forms.Textarea, label="Ausführliche Problembeschreibung")
|
||||||
self.fields['name'].widget.attrs['readonly'] = True
|
self.fields['name'].widget.attrs['readonly'] = True
|
||||||
self.fields['mail'].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_1"] = forms.FileField(label="Anhang 1", required=False)
|
||||||
self.fields["attachment_2"] = forms.FileField(label="Anhang 2", 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_3"] = forms.FileField(label="Anhang 3", required=False)
|
||||||
|
|
||||||
class NewAgencyForm(forms.Form):
|
class NewAgencyForm(forms.Form):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -742,6 +742,7 @@ def support(request):
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = request.POST
|
form = request.POST
|
||||||
|
'''
|
||||||
fileblob = ""
|
fileblob = ""
|
||||||
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
|
||||||
|
|
@ -770,7 +771,7 @@ def support(request):
|
||||||
fileblob = fileblob[1 : : ]
|
fileblob = fileblob[1 : : ]
|
||||||
fileblob = fileblob[:-1:]
|
fileblob = fileblob[:-1:]
|
||||||
attachments.append({str(filename) : "data:" + attachment_type.mime + ";base64," + fileblob})
|
attachments.append({str(filename) : "data:" + attachment_type.mime + ";base64," + fileblob})
|
||||||
|
'''
|
||||||
#image = request.FILES
|
#image = request.FILES
|
||||||
supportdata = dict(form)
|
supportdata = dict(form)
|
||||||
# Data from Form to JSON-Format
|
# Data from Form to JSON-Format
|
||||||
|
|
@ -779,8 +780,6 @@ def support(request):
|
||||||
problemconc = str(supportdata['problemconc'][0])
|
problemconc = str(supportdata['problemconc'][0])
|
||||||
problem = str(supportdata['problem'][0])
|
problem = str(supportdata['problem'][0])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# HEADERS CURL
|
# HEADERS CURL
|
||||||
headers = {'X-API-Key': 'F025A238EB74914E3653BA2989BFF7C4'}
|
headers = {'X-API-Key': 'F025A238EB74914E3653BA2989BFF7C4'}
|
||||||
subject = "Digitale Agentur: " + str(problemconc)
|
subject = "Digitale Agentur: " + str(problemconc)
|
||||||
|
|
@ -792,13 +791,12 @@ def support(request):
|
||||||
"email": mail,
|
"email": mail,
|
||||||
"subject": 'Digitale Agentur: '+problemconc,
|
"subject": 'Digitale Agentur: '+problemconc,
|
||||||
"ip": "1.1.1.1",
|
"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,
|
"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
|
#"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)
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue