I
I
ineveraskdfrths2020-05-11 23:21:35
Django
ineveraskdfrths, 2020-05-11 23:21:35

How to pass a value to a django function?

There is a function:

def Shop(request, current_server = "Test_server"):
    items = Shop_cat.objects.filter(mod_id__server_mods__name=current_server)
    return render(request, 'donate/shop.html', {"shop_list": items})

How to accept current_server value from front? Interested in exactly how to fix the function so that it starts to take on a value. (Get csfr+¤t_server=*Name* comes from the front)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bubaley, 2020-05-12
@ineveraskdfrths

GET should contain all your query parameters.
request.GET.get('current_server')
And csrf should be given in headers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question