Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
i have a edit_profile view at my django application that also checks if the pgp key the users saves to his profile is in RSA format, Anyways if i add a profile avatar for the very first time it works like a charm, if i want to clear or delete it, im always jumping onto the execpt block and the user avatar remains unchanged. Well i dont see a clear reason why at the point can maybe smb give me a hint here:
views.py
def edit_profile(request):if request.method =='POST':
form =UserForm(request.POST, request.FILES, instance=request.user)try:
pubpgp = request.POST.get('pubpgp')ifnot pubpgp orPGPKey.from_blob(pubpgp.rstrip("\r\n"))[0].key_algorithm ==PubKeyAlgorithm.RSAEncryptOrSign:if form.is_valid():
form.save()
messages.success(request,"Profile has been updated successfully.")return redirect(reverse('home'))else:print(form.errors)return render(request,'app_Accounts/edit_profile.html',{'form': form})else:
messages.error(request,"Uuups, something went wrong, please try again.")return render(request,'app_Accounts/edit_profile.html',{'form': form})exceptExceptionas e:print(e.args)
messages.error(request,"PGP-Key is wrong formated.")return render(request,'app_Accounts/edit_profile.html',{'form': form})else:
form =UserForm(instance=request.user)
args ={'form': form}return render(request,'app_Accounts/edit_profile.html', args)
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
2 years ago
i have a edit_profile view at my django application that also checks if the pgp key the users saves to his profile is in RSA format, Anyways if i add a profile avatar for the very first time it works like a charm, if i want to clear or delete it, im always jumping onto the execpt block and the user avatar remains unchanged. Well i dont see a clear reason why at the point can maybe smb give me a hint here:
views.py
forms.py