From ec4f358356bd0ad4b51ba38b6a0f9e5f52b65154 Mon Sep 17 00:00:00 2001 From: VGR6479 Date: Thu, 11 Jul 2024 10:12:24 +0700 Subject: [PATCH] Bug Fix --- gerobug_dashboard/dashboards/views.py | 38 +++++++++++++++------------ gerobug_dashboard/requirements.txt | 2 +- gerobug_web/requirements.txt | 2 +- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/gerobug_dashboard/dashboards/views.py b/gerobug_dashboard/dashboards/views.py index d5569e1..50eeb37 100644 --- a/gerobug_dashboard/dashboards/views.py +++ b/gerobug_dashboard/dashboards/views.py @@ -516,7 +516,22 @@ def AdminSetting(request): logging.getLogger("Gerologger").info("Company Identity updated successfully") messages.success(request,"Company Identity updated successfully!") return redirect('setting') - + + personalization = PersonalizationForm(request.POST) + if personalization.is_valid(): + theme = Personalization.objects.get(personalize_id=1) + theme.main_1 = personalization.cleaned_data.get('main_1') + theme.main_2 = personalization.cleaned_data.get('main_2') + theme.secondary_1 = personalization.cleaned_data.get('secondary_1') + theme.secondary_2 = personalization.cleaned_data.get('secondary_2') + theme.secondary_3 = personalization.cleaned_data.get('secondary_3') + theme.button_1 = personalization.cleaned_data.get('button_1') + theme.save() + + logging.getLogger("Gerologger").info("Personalization updated successfully") + messages.success(request,"Personalization updated successfully!") + return redirect('setting') + troubleshoot = TroubleshootForm(request.POST) if troubleshoot.is_valid(): if troubleshoot.cleaned_data.get('troubleshoot_1') == True: @@ -560,21 +575,6 @@ def trigger_recovery(report_name, id, type): logging.getLogger("Gerologger").info("Troubleshoot Executed: RECOVER LOSS REPORT FILES") return redirect("setting") - - personalization = PersonalizationForm(request.POST) - if personalization.is_valid(): - theme = Personalization.objects.get(personalize_id=1) - theme.main_1 = personalization.cleaned_data.get('main_1') - theme.main_2 = personalization.cleaned_data.get('main_2') - theme.secondary_1 = personalization.cleaned_data.get('secondary_1') - theme.secondary_2 = personalization.cleaned_data.get('secondary_2') - theme.secondary_3 = personalization.cleaned_data.get('secondary_3') - theme.button_1 = personalization.cleaned_data.get('button_1') - theme.save() - - logging.getLogger("Gerologger").info("Personalization updated successfully") - messages.success(request,"Personalization updated successfully!") - return redirect('setting') THEME = Personalization.objects.get(personalize_id=1) RULES = StaticRules.objects.get(pk=1) @@ -590,12 +590,16 @@ def ReviewerDelete(request,id): if User.objects.filter(id=id).count() != 0: User.objects.filter(id=id).delete() messages.success(request,"User is deleted successfully!") - return redirect('setting') + logging.getLogger("Gerologger").info("USER ID " + str(id) + " SUCCESSFULLY DELETED BY " + str(request.user.username)) + return redirect('dashboard') + except Exception as e: logging.getLogger("Gerologger").error(str(e)) messages.error(request,"Something wrong. The delete operation is unsuccessful. Please report to the Admin!") return redirect('setting') + return redirect('setting') + return render(request,'setting.html') @login_required diff --git a/gerobug_dashboard/requirements.txt b/gerobug_dashboard/requirements.txt index 29076f1..a830b96 100644 --- a/gerobug_dashboard/requirements.txt +++ b/gerobug_dashboard/requirements.txt @@ -6,7 +6,7 @@ django-bleach django-colorfield==0.10.1 django-crispy-forms django-quill-editor -django==4.2.11 +django==5.0.7 gunicorn==22.0.0 libmagic psycopg2 diff --git a/gerobug_web/requirements.txt b/gerobug_web/requirements.txt index 2290e05..611e6b0 100644 --- a/gerobug_web/requirements.txt +++ b/gerobug_web/requirements.txt @@ -1,6 +1,6 @@ django-bleach django-colorfield==0.10.1 django-quill-editor -django==4.2.11 +django==5.0.7 gunicorn==22.0.0 psycopg2 \ No newline at end of file