Комментарии:
How can I sort the posts of one user, for example, I only want to display the posts of a user who uploaded them on his own account, like the technology in Facebook, that is, when I upload a post, I can see it on my own page, I want to do something similar to that But I haven't succeeded yet
ОтветитьIt is interesting. If I select only the firstname and the age it is also possible to display the surename and the classroom. The SQL querie ('sql': 'SELECT "student_student"."id", "student_student"."firstname", "student_student"."age" FROM "student_student" WHERE "student_student"."classroom" = 1)
calls only the firstname and age but its seems to take the whole instance ...
So what does the ".only()" do?
students = Student.objects.filter(class_room=2).only('first_name') also gives last name as well.
Ответитьbut in my case it is still access all data from post ???????????
posts = User.objects.filter(last_name__contains='Khan').only("username", "email")
Use have solved my biggest problem of working with database in django. Please Make Videos on other methods(like select_related,exclude) also.
Ответитьthis is great thank you
ОтветитьThis is a great series. It's great to slow down and focus on one aspect of Django.
Ответитьthanks very much for this series
ОтветитьCan we see a video on select_related and prefetch_related.?
Ответить