(self, other, grouptitle, myname, othername)
Group the podcast with another one
Group the podcast with another one
Group the podcast with another one
def group_with(self, other, grouptitle, myname, othername):
        """Group the podcast with another one"""
        # TODO: move to PodcastGroup?

        if bool(self.group) and (self.group == other.group):
            # they are already grouped
            return

        group1 = self.group
        group2 = other.group

        if group1 and group2:
            raise ValueError("both podcasts already are in different groups")

        elif not (group1 or group2):
            # Form a new group
            import uuid

            group = PodcastGroup.objects.create(id=uuid.uuid1(), title=grouptitle)
            self.group_member_name = myname
            self.group = group
            self.save()

            other.group_member_name = othername
            other.group = group
            other.save()

            return group

        elif group1:
            # add other to self's group
            other.group_member_name = othername
            other.group = group1
            other.save()
            return group1

        else:
            # add self to other's group
            self.group_member_name = myname
            self.group = group2
            self.save()
            return group2
def group_with ( self , other , grouptitle , myname , othername ) : # TODO: move to PodcastGroup? if bool ( self . group ) and ( self . group == other . group ) : # they are already grouped return group1 = self . group group2 = other . group if group1 and group2 : raise ValueError ( "both podcasts already are in different groups" ) elif not ( group1 or group2 ) : # Form a new group import uuid group = PodcastGroup . objects . create ( id = uuid . uuid1 ( ) , title = grouptitle ) self . group_member_name = myname self . group = group self . save ( ) other . group_member_name = othername other . group = group other . save ( ) return group elif group1 : # add other to self's group other . group_member_name = othername other . group = group1 other . save ( ) return group1 else : # add self to other's group self . group_member_name = myname self . group = group2 self . save ( ) return group2