Answer the question
In order to leave comments, you need to log in
How to bind django sql queries to a view and send the result to the template?
There is a method
def main_rospis(request):
pred = Rospisanie.objects.raw('Select full_name as den, vremy as nachalo, nazvanie as gruppa, name as predmet, surname as prepod from DniNedeli_dninedeli INNER JOIN rospisanie_rospisanie ON DniNedeli_dninedeli.id = rospisanie_rospisanie.kod_dny_r_id INNER JOIN urok_urok ON urok_urok.id = rospisanie_rospisanie.urok_r_id INNER JOIN gruppa_gruppa ON gruppa_gruppa.id = rospisanie_rospisanie.gruppa_r_id INNER JOIN predmet_predmet ON predmet_predmet.id = rospisanie_rospisanie.predmet_r_id INNER JOIN prepod_prepodavatel ON prepod_prepodavatel.id = rospisanie_rospisanie.prepod_r_id')
return render(request, 'papka/list.html', {'preds':pred})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question