diff --git a/src/profiles/views.py b/src/profiles/views.py index d4d4b10..4f60c2c 100644 --- a/src/profiles/views.py +++ b/src/profiles/views.py @@ -1,3 +1,4 @@ +from django.contrib import messages from django.contrib.auth import logout from django.contrib.auth.mixins import LoginRequiredMixin as LRM from django.http import JsonResponse @@ -20,6 +21,7 @@ def get(self, request, **kwargs): return render(request, "profiles/profile_detail.html", ctx) def post(self, request, **kwargs): + # js reload page: trigger dj msg uuid = kwargs.get("uuid") profile = get_object_or_404(Profile, uuid=uuid) form = ProfileForm(request.POST, request.FILES, profile) @@ -30,6 +32,7 @@ def post(self, request, **kwargs): else: profile.avatar = None profile.save() + messages.success(request, "Avatar changed successfully") return JsonResponse({"status_code": 200, "resp": "OK"}) else: return JsonResponse({"status_code": 404, "err": form.errors}) diff --git a/src/static/js/utils.js b/src/static/js/utils.js index e662f0e..cac1394 100644 --- a/src/static/js/utils.js +++ b/src/static/js/utils.js @@ -86,11 +86,6 @@ function fileToDataUri(file) { }); } -// const colorSVG = (colorCls)=>{ -// let circle = document.getElementById("avaColor") -// circle.classList.add(colorCls); -// } - diff --git a/src/templates/components/menu.html b/src/templates/components/menu.html index a242b22..724aff2 100644 --- a/src/templates/components/menu.html +++ b/src/templates/components/menu.html @@ -48,6 +48,13 @@ {% trans 'Subscribe to news' %} + {% else %} +
  • + {% endif %}