Skip to content

Instantly share code, notes, and snippets.

@valerybriz
Created May 2, 2019 21:52
Show Gist options
  • Save valerybriz/efb79a1571bba2f398e6e72e51f82dae to your computer and use it in GitHub Desktop.
Save valerybriz/efb79a1571bba2f398e6e72e51f82dae to your computer and use it in GitHub Desktop.
Create the query filtering users
# Create the query filtering users with email myemail@gmail.com
users = User.objects.get(email="myemail@gmail.com")
users.name # Hit the database and retrieve the name value
users.name # cached version, no database access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment