Improved the condition of fetching key name

This commit is contained in:
PCoder 2017-09-13 07:03:49 +05:30
parent 01795dcad0
commit d92e850f3e

View file

@ -98,6 +98,7 @@ class UserHostingKeyForm(forms.ModelForm):
if openssh_pubkey_str in get_all_public_keys(self.request.user): if openssh_pubkey_str in get_all_public_keys(self.request.user):
key_name = UserHostingKey.objects.filter( key_name = UserHostingKey.objects.filter(
user_id=self.request.user.id,
public_key=openssh_pubkey_str).first().name public_key=openssh_pubkey_str).first().name
KEY_EXISTS_MESSAGE = _( KEY_EXISTS_MESSAGE = _(
"This key exists already with the name %(name)s") % { "This key exists already with the name %(name)s") % {