this gives us al those names which are in the given college?
Object.student_set.all
and how did the detailview knows that which college i m talking about?
Hello Yashu, yes object.student_all() will give us a queryset that consists of all the students related to a particular college. And talking about detail view we need to pass the parameter like basically we pass the primary key , id to signify the object about which we are talking. By the specific id we can tell about the specific object and so on about the corresponding fields of that particular object.
I hope it is clear to you. Pls feel free to ask if there is anything else you want to know. I will try to help you out.
In case it is clear to you pls mark it as resolve and provide the feedback/rating so that we can improve ourselves.
Thanks
Happy Coding !!
why we write small s in student whereas in models we have Students?
Maybe you are saying about the model name, so yeah by convention we take the first letter into capital form and we can use small letters for the operations like calling the set_all. See, in Django, some of the grammar and writing convention is already defined so that it is easy to use.
For example, suppose you have a table named student and when you will register it to the admin panel then there you will see Students in the plural form. And more about the way we use the Django fields are mentioned in the official documentation of the Django.
I hope it is clear to you, pls ask if anything is not clear to you or seems confusing, I will try to help you out.
In case it is clear to you pls mark it as resolve and pls provide the rating as well as feedback so that we can improve ourselves.
Thanks
Happy Coding !!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.