QS 0.9.1 PORD
This commit is contained in:
parent
c8bb742d70
commit
23d2405838
Binary file not shown.
Binary file not shown.
|
|
@ -173,7 +173,7 @@ SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) + '/..'
|
||||||
|
|
||||||
STATICFILES_DIRS = (os.path.join(SITE_ROOT, 'users/static/'),)
|
STATICFILES_DIRS = (os.path.join(SITE_ROOT, 'users/static/'),)
|
||||||
|
|
||||||
STATIC_ROOT = (os.path.join(SITE_ROOT, 'collectedstatic'))
|
#STATIC_ROOT = (os.path.join(SITE_ROOT, 'collectedstatic'))
|
||||||
|
|
||||||
# CRISPY
|
# CRISPY
|
||||||
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ urlpatterns = [
|
||||||
path('chat/', include('chat.urls'), name='chat'),
|
path('chat/', include('chat.urls'), name='chat'),
|
||||||
path('api-token-auth/', obtain_auth_token, name='api-token-auth'),
|
path('api-token-auth/', obtain_auth_token, name='api-token-auth'),
|
||||||
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
#if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
# ERROR HANDLERS
|
# ERROR HANDLERS
|
||||||
handler404 = 'users.views.handler404'
|
handler404 = 'users.views.handler404'
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,14 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#id_problem').summernote({
|
$('#id_problem').summernote({
|
||||||
height: 320,
|
height: 320,
|
||||||
lang: "de-DE",
|
lang: "de-DE",
|
||||||
disableDragAndDrop: true
|
disableDragAndDrop: true
|
||||||
});
|
});
|
||||||
});
|
});*/
|
||||||
</script>
|
</script>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +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_2"] = forms.FileField(label="Anhang 2", 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):
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ from channels_presence.models import Presence
|
||||||
import channels.layers
|
import channels.layers
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from timemanagement.models import Workday
|
from timemanagement.models import Workday
|
||||||
|
import base64
|
||||||
|
|
||||||
def randomString(stringLength=10):
|
def randomString(stringLength=10):
|
||||||
"""Generate a random string of fixed length """
|
"""Generate a random string of fixed length """
|
||||||
|
|
@ -740,6 +741,18 @@ def support(request):
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = request.POST
|
form = request.POST
|
||||||
|
|
||||||
|
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()))})
|
||||||
|
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()))})
|
||||||
|
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()))})
|
||||||
|
|
||||||
#image = request.FILES
|
#image = request.FILES
|
||||||
supportdata = dict(form)
|
supportdata = dict(form)
|
||||||
# Data from Form to JSON-Format
|
# Data from Form to JSON-Format
|
||||||
|
|
@ -748,6 +761,8 @@ 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)
|
||||||
|
|
@ -759,11 +774,14 @@ 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": "data/html;charset=utf-8;*****************************\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
|
||||||
|
|
||||||
}
|
}
|
||||||
json_data = json.dumps(ostdata)
|
json_data = json.dumps(ostdata)
|
||||||
|
|
||||||
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
|
||||||
if(r.status_code != 201):
|
if(r.status_code != 201):
|
||||||
messages.warning(request, f'Supportanfrage fehlgeschlagen!' + str(r))
|
messages.warning(request, f'Supportanfrage fehlgeschlagen!' + str(r))
|
||||||
|
|
@ -916,3 +934,4 @@ def cronactionsdaily(request, code):
|
||||||
data.update({"status" : "failed"})
|
data.update({"status" : "failed"})
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue