All pastes #791756 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-21 02:00 UTC
rendered paste body
#Compare 4 Translations	
def compare_chapter4(request, translations, book, chapter):

	#Grab Current Book Data 
	book_no_dashes = string.replace(book, '-', ' ')
	b = Book.objects.get(name=book_no_dashes)
	
	#translation string could bee 'KJV' or 'KJV-ASV-BBE' and it wil return an aray of translations
	p = re.compile('[A-Za-z]+')
	trans_array = p.findall(translations)
	
	scripture = Scripture.objects.filter(translation__activated=1, verse__book=b.id, verse__chapter=chapter)
	
	#Find chapter for all translations passed
	for trans in trans_array
		scripture = scripture.filter(translation__acronym=trans)
		
	#Find Next Book and Chapter To Pass To Template
	next_chap = next_chapter(book_no_dashes, chapter)
			
	#Find Previous Book and Chapter To Pass To Template
	previous_chap = previous_chapter(book_no_dashes, chapter)
		
	
	
	translation_comparison = ''	
	for i in range(0, len(scripture1)):
		translation_comparison += '<tr>'
		translation_comparison += '<td><p><sup><a title="View this scripture" href="/bible/%s/%s/%s/%s/">%s</a></sup> %s</p></td>' % (trans1, book, chapter, scripture1[i].verse.verse, scripture1[i].verse.verse, scripture1[i].scripture)
		translation_comparison += '<td><p><sup><a title="View this scripture" href="/bible/%s/%s/%s/%s/">%s</a></sup> %s</p></td>' % (trans2, book, chapter, scripture1[i].verse.verse, scripture2[i].verse.verse, scripture2[i].scripture)
		translation_comparison += '<td><p><sup><a title="View this scripture" href="/bible/%s/%s/%s/%s/">%s</a></sup> %s</p></td>' % (trans3, book, chapter, scripture1[i].verse.verse, scripture3[i].verse.verse, scripture3[i].scripture)
		translation_comparison += '<td><p><sup><a title="View this scripture" href="/bible/%s/%s/%s/%s/">%s</a></sup> %s</p></td>' % (trans4, book, chapter, scripture1[i].verse.verse, scripture4[i].verse.verse, scripture4[i].scripture)
		translation_comparison += '</tr>'

	return render_to_response('parallel/chapter/compare4.html', 
	{
	'translation_comparison': 	translation_comparison, 
	'next_book': 			next_chap[0],
	'next_chapter':			next_chap[1],
	'previous_book': 		previous_chap[0],
	'previous_chapter': 		previous_chap[1],
	'trans1': 			trans1, 
	'trans1_name': 			scripture1[0].translation,  
	'trans2': 			trans2, 
	'trans2_name': 			scripture2[0].translation, 
	'trans3': 			trans3, 
	'trans3_name': 			scripture3[0].translation, 
	'trans4': 			trans4, 
	'trans4_name': 			scripture4[0].translation, 
	'book_no_dashes': 		book_no_dashes,
	'book':				book,
	'chapter': 			chapter
	})