question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I have a problem `created_by_user_email` method

See original GitHub issue

HI, thank you for the django-sql-explorer

i have a problem below code

https://github.com/groveco/django-sql-explorer/blob/962874523390a575105dde3a0dfdcecf881384db/explorer/forms.py#L54-L57

i made it Customizing authentication in Django(https://docs.djangoproject.com/en/2.2/topics/auth/customizing/)

i don`t have 'User' object has no attribute 'email'

Please help me with what to do. thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
soulwawacommented, Dec 8, 2020

Thank you very much indeed! @marksweb

1reaction
markswebcommented, Dec 8, 2020

@soulwawa So in some python, for your User model, you might do something like…

from django.contrib.auth import get_user_model

User = get_user_model()

first_user = User.objects.first()

email = first_user.user_email

If so, I would recommend you add a property to the user model for compatibility with things which expect a User instance to have an email. I’d say it’s uncommon not to be able to do user.email.

    @property
    def email(self):
        """
        Compatibility property to provide email value
        """
        return self.user_email
Read more comments on GitHub >

github_iconTop Results From Across the Web

What does the error "This email address is already used by ...
While trying to add a new support address or a user as staff, I get the error This email address is already used...
Read more >
Error occurs when you send or receive an email message in ...
This article lists common methods to help you troubleshoot problems that you may experience when you receive or send an email message in...
Read more >
Creating issues and comments from email | Administering Jira ...
Admins can configure Jira to receive and process emails. Jira can receive emails from licensed users to create issues or add comments and ......
Read more >
Add or change payments user email preferences
Add or change payments email contacts​​ Click Settings. Under "Payments users," click Manage payments users. To change a user's notification settings, click the...
Read more >
Email-based self-registration - MoodleDocs
The email-based self-registration authentication method enables users to create their own accounts via the 'Create new account' button on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found