L
L
Little Vasya2018-08-30 20:37:20
Django
Little Vasya, 2018-08-30 20:37:20

How to send a request for the category of the current user by MutlipleChoiceFIield?

How to send a post request to the category of the current user, let's say there are many users and each has a field where he can add something

def add_product(request):
    form = ProductForm()
    if request.method == 'POST':
        form = ProductForm(request.POST, request.FILES)

        if form.is_valid():
            product_form = form.save(commit=False)
            product_form.category =  <i>Здесь нужно отправить</i>
            product_form.save()

            return redirect(product)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question