I use mysql table as temporary storage of my data that I parse. I've tried to get data from the table, save it to variables, delete rows from table and bring model's objects (that were saved to the variables) to template, but unsuccessful. QuerySet are lazy, but I want to get data from table, not only pointers. How I could do this?
fop_rating = Edata.objects.values('recipt_name').filter(recipt_edrpou='xxxxxxxxxx').annotate(total=Sum('amount')).order_by('-total')[:10]
uric_rating = Edata.objects.values('recipt_name').exclude(recipt_edrpou='xxxxxxxxxx').annotate(total=Sum('amount')).order_by('-total')[:10]
rows = Edata.objects.filter(rand_ind=rand_ind)
for r in rows: # delete all the rows
r.delete()
return render(request,'edata/index.html',{"data":data,'fop_rating':fop_rating,'uric_rating':uric_rating})