mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
users: Cosmetic yapf and isort fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
2317e6bd94
commit
a66d50fb89
@ -15,30 +15,34 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import django.views.generic
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth import update_session_auth_hash
|
from django.contrib.auth import update_session_auth_hash
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.messages.views import SuccessMessageMixin
|
from django.contrib.messages.views import SuccessMessageMixin
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.views.generic.edit import (CreateView, DeleteView, UpdateView,
|
from django.utils.translation import ugettext as _
|
||||||
FormView)
|
from django.utils.translation import ugettext_lazy
|
||||||
import django.views.generic
|
from django.views.generic.edit import (CreateView, DeleteView, FormView,
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
UpdateView)
|
||||||
|
|
||||||
from .forms import CreateUserForm, UserChangePasswordForm, UserUpdateForm, \
|
|
||||||
FirstBootForm
|
|
||||||
from . import get_last_admin_user
|
|
||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth.errors import ActionError
|
from plinth.errors import ActionError
|
||||||
from plinth.modules import first_boot
|
from plinth.modules import first_boot
|
||||||
from plinth.utils import is_user_admin
|
from plinth.utils import is_user_admin
|
||||||
|
|
||||||
subsubmenu = [{'url': reverse_lazy('users:index'),
|
from . import get_last_admin_user
|
||||||
'text': ugettext_lazy('Users')},
|
from .forms import (CreateUserForm, FirstBootForm, UserChangePasswordForm,
|
||||||
{'url': reverse_lazy('users:create'),
|
UserUpdateForm)
|
||||||
'text': ugettext_lazy('Create User')}]
|
|
||||||
|
subsubmenu = [{
|
||||||
|
'url': reverse_lazy('users:index'),
|
||||||
|
'text': ugettext_lazy('Users')
|
||||||
|
}, {
|
||||||
|
'url': reverse_lazy('users:create'),
|
||||||
|
'text': ugettext_lazy('Create User')
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
class ContextMixin(object):
|
class ContextMixin(object):
|
||||||
@ -157,11 +161,10 @@ class UserDelete(ContextMixin, DeleteView):
|
|||||||
messages.success(self.request, message)
|
messages.success(self.request, message)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
actions.superuser_run(
|
actions.superuser_run('users',
|
||||||
'users', ['remove-user', self.kwargs['slug']])
|
['remove-user', self.kwargs['slug']])
|
||||||
except ActionError:
|
except ActionError:
|
||||||
messages.error(self.request,
|
messages.error(self.request, _('Deleting LDAP user failed.'))
|
||||||
_('Deleting LDAP user failed.'))
|
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user