diff --git a/gnuviechadmin/osusers/views.py b/gnuviechadmin/osusers/views.py index 46fe4e8..0f74cf7 100644 --- a/gnuviechadmin/osusers/views.py +++ b/gnuviechadmin/osusers/views.py @@ -98,6 +98,12 @@ class AddSshPublicKey( class ListSshPublicKeys( HostingPackageAndCustomerMixin, StaffOrSelfLoginRequiredMixin, ListView ): + """ + This view is used for showing the list of :py:class:`SSH public keys + ` assigned to the hosting package specified + via URL parameter 'pattern'. + + """ model = SshPublicKey context_object_name = 'keys' @@ -114,9 +120,19 @@ class ListSshPublicKeys( class DeleteSshPublicKey( HostingPackageAndCustomerMixin, StaffOrSelfLoginRequiredMixin, DeleteView ): + """ + This view is used for delete confirmation of a :py:class:`SSH public key + `. + + """ + model = SshPublicKey context_object_name = 'key' + def get_queryset(self): + return super(DeleteSshPublicKey, self).get_queryset().filter( + user=self.get_hosting_package().osuser) + def get_context_data(self, **kwargs): context = super(DeleteSshPublicKey, self).get_context_data(**kwargs) context.update({ @@ -135,12 +151,21 @@ class DeleteSshPublicKey( class EditSshPublicKeyComment( HostingPackageAndCustomerMixin, StaffOrSelfLoginRequiredMixin, UpdateView ): + """ + This view is used for editing the comment field of a :py:class:`SSH public + key `. + + """ model = SshPublicKey context_object_name = 'key' fields = ['comment'] template_name_suffix = '_edit_comment' form_class = EditSshPublicKeyCommentForm + def get_queryset(self): + return super(EditSshPublicKeyComment, self).get_queryset().filter( + user=self.get_hosting_package().osuser) + def get_form_kwargs(self): kwargs = super(EditSshPublicKeyComment, self).get_form_kwargs() kwargs['hostingpackage'] = self.get_hosting_package()