Understanding related_name

আমরা যদি related_name এট্রিবিউট ব্যবহার না করি তাহলে ডিফল্ট modelname_set ব্যবহার করতে হবে আর related_name এট্রিবিউট ব্যবহার করলে আমরা সরাসরি modelname.field এ একসেস করতে পারবো।

By specifying related_name, you can replace the default reverse relation name, which is typically the lowercase name of the related model followed by “_set”. For example, without related_name, you would access related comments like this: post.comment_set.all().

Last updated