I would like to know if I can display a view inside another view with django.
This is what I tried to do:
def displayRow(request, row_id):
row = Event.objects.get(pk=row_id)
return render_to_response('row.html', {'row': row})
def listEventsSummary(request):
listEventsSummary = Event.objects.all().order_by('-id')[:20]
response = ''
for event in listEventsSummary:
response += str(displayRow('',event.id))
return HttpResponse(response)
The output looks like what I was expecting but I have had to replace the request value with an empty string. Is that fine or is there a better way to do it?