[Answer]-Django view to retrieve data from db based on number or current date

1👍

Model.objects.filter() returns a QuerySet. If you are sure that a filter returns only one model you can do KleedkamerIndeling.objects.get(speel_ronde=25). Otherwise the QuerySet behaves like a list, that means you can for example take out the first one (kleedkamer1 = queryset[0].kleedkamer_1).

👤toabi

0👍

Queryset is a list. So you have to take 1st index from that list, like:

def vandaag(request):
    queryset = KleedkamerIndeling.objects.all().filter(speel_ronde=25)[0] 
👤ruddra

Leave a comment