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

AttributeError will be raised if User is not using email. #551

Closed
moonwalkerpoday opened this issue Sep 22, 2023 · 3 comments
Closed

AttributeError will be raised if User is not using email. #551

moonwalkerpoday opened this issue Sep 22, 2023 · 3 comments

Comments

@moonwalkerpoday
Copy link

moonwalkerpoday commented Sep 22, 2023

I am using a custom user that inherits from AbstractBaseUser and I get an AttributeError.

image

The reason is that the email is referenced in the created_by_user_email method of the QueryForm.

...
    @property
    def created_by_user_email(self):
        return self.instance.created_by_user.email if \
            self.instance.created_by_user else '--'
...

I think it is better not to fix it to email, because there are cases where email is not used.
I will create a pull request, any other ideas or opinions?
thank you

@moonwalkerpoday
Copy link
Author

Sorry, the issue was duplicated.
#422

@marksweb
Copy link
Collaborator

No change was made following #422 from what I can see.

You could raise a PR that addresses this, but it's a bigger problem than just created_by_user_email.

In a potential change, created_by_user_email should be renamed because what this is actually doing is providing a way to identify which user is associated to something in the templates. But obviously created_by_user_id or something would make you expect a number for the user's ID, when infact what we're looking for here is an identifier for a user.

There is more functionality in the app that expects a user to have an email address, so that would need to be fixed as well if we're going to bring support for users without an email address.

@chrisclark
Copy link
Collaborator

Addressed via: #606

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