Model Relationship

A GroupTask can be associated with many Project. Given your structure, there’s no such relationship as “GroupTask with Project 1”. If this is a requirement, you may need to rethink your data structure. In particular, you might want to consider whether or not “GroupTask X” assigned to Project 1 is really the same GroupTask as the GroupTask assigned to Project 2.

To answer your other question, given a GroupTask named group_task, the list of Projects associated with it is accessed through a RelatedManager: group_task.project_set.all().

1 Like