def create(request): form, handled = UserForm.maybe_handle(request) if handled: return handled return shortcuts.render(request, 'syspanel/users/create.html', {'form': form})
def create(request): form, handled = UserForm.maybe_handle(request) if handled: return handled context = {'form': form} if request.is_ajax(): template = 'syspanel/users/_create.html' context['hide'] = True else: template = 'syspanel/users/create.html' return shortcuts.render(request, template, context)
'syspanel/users/update.html', { 'form': form, 'user_id': user_id}) @login_required def create(request): try: tenants = api.tenant_list(request) except api_exceptions.ApiException, e: messages.error(request, _('Unable to retrieve tenant list: %s') % e.message) return shortcuts.redirect('horizon:syspanel:users:index') if request.method == "POST": form = UserForm(request.POST, tenant_list=tenants) if form.is_valid(): user = form.clean() # TODO Make this a real request try: LOG.info('Creating user with name "%s"' % user['name']) new_user = api.user_create(request, user['name'], user['email'], user['password'], user['tenant_id'], True) messages.success(request, _('User "%s" was successfully created.') % user['name']) try: