Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'bool' object is not callable #248

Open
bdbais opened this issue Nov 28, 2019 · 2 comments
Open

'bool' object is not callable #248

bdbais opened this issue Nov 28, 2019 · 2 comments

Comments

@bdbais
Copy link

bdbais commented Nov 28, 2019

I've installed this module to try, on admin site I created a form and save it, when I viewed on site it send me this error:

'bool' object is not callable

File "projectX\venv\lib\site-packages\forms_builder\forms\views.py" in get
39. if login_required and not request.user.is_authenticated():

Exception Type: TypeError at /forms_builder/test-form-builder/
Exception Value: 'bool' object is not callable

-------------- Possible fix: forms_builder\forms\views.py

def get(self, request, *args, **kwargs):
    context = self.get_context_data(**kwargs)
    login_required = context["form"].login_required
    username = request.POST.get('username')
    password = request.POST.get('password')
    user = authenticate(username=username, password=password)
    if login_required and user is not None:
    #if login_required and not request.user.is_authenticated():
        path = urlquote(request.get_full_path())
        bits = (settings.LOGIN_URL, REDIRECT_FIELD_NAME, path)
        return redirect("%s?%s=%s" % bits)
    return self.render_to_response(context)


@modo24
Copy link

modo24 commented Jul 25, 2020

You need to import too:

from django.contrib.auth import authenticate

@giriannamalai
Copy link

Github source is not having this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants