Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はdjangoでアプリに取り組んでいますが、複数のオブジェクトを1つの親にチェーンする方法があるかどうか疑問に思っています。
たとえば、-query_1-、-query_2-があり、それらのクエリが返すオブジェクトを1つの-parent_object-に入れて、テンプレートに渡します。これは、テンプレート側で{{parent_object.query_1のようにアクセスできます。 .field}}、これは可能ですか、それとも同様の効果を達成する方法はありますか?
from itertools import chain chained_qs = chain(qs1, qs2)