KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Suppose i have : class Library(models.Model): name = models.CharField(max_length = 100) class Books(models.Model): library = models.ForeignKey(Library) book = models.CharField(max_length = 100) I want to create a new Books , we know we can fill the library on Books with just Library 's id, but we can also use instance of Library . My question is, is it better if we just provide the id? If i want to use the instance, then i have to evaluate using .get() , then does it hit the database? Additional question : From the docs, queryset are lazy, it does not hit the database till evaluated, so when does queryset evaluated?
Tags (comma-separated)
Save Edits
Cancel