def get_data_rows(cls,ar): qs = VerseText.objects.all() if ar.param_values.p_book: qs = qs.filter(verse__book=ar.param_values.p_book) if ar.param_values.p_chapter: qs = qs.filter(verse__chapter=ar.param_values.p_chapter) verses = dict() versenos = [] for obj in qs.order_by('verse__verseno','verse__verseno_suffix'): k = obj.verse.pk v = verses.get(k,None) if v is None: versenos.append(k) v = AttrDict(pk=k,left='',right='',verse=obj.verse) verses[k] = v if obj.edition == ar.param_values.edition1: v.left = obj.text elif obj.edition == ar.param_values.edition2: v.right = obj.text for k in versenos: yield verses[k]