[Answered ]-Use variable as field in ORM query

2👍

You could try this:

def Pole(request, pole, nazwa):

    try:
        criteria = {pole: nazwa}
        entry = Entry.objects.get(**criteria)
        return HttpResponse(entry.wpis)
    except Entry.DoesNotExist:
        return HttpResponse("Nuffin")
👤Gocht

Leave a comment