From d92e850f3e7f18dba9b734e2ae27d5fa245f555e Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 13 Sep 2017 07:03:49 +0530 Subject: [PATCH] Improved the condition of fetching key name --- hosting/forms.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hosting/forms.py b/hosting/forms.py index 1b68a7df..2ebc6f48 100644 --- a/hosting/forms.py +++ b/hosting/forms.py @@ -98,6 +98,7 @@ class UserHostingKeyForm(forms.ModelForm): if openssh_pubkey_str in get_all_public_keys(self.request.user): key_name = UserHostingKey.objects.filter( + user_id=self.request.user.id, public_key=openssh_pubkey_str).first().name KEY_EXISTS_MESSAGE = _( "This key exists already with the name %(name)s") % {