1

After the form is submitted a get request with parameters will be created, I was struggling with the regex in the urls.py I want to know the pattern for this Get request

/create-usecase/?usecase_name=test&category=1&sub_category=msameh&csrfmiddlewaretoken=m4UIwr0qsWuAwVJq7OCLt6KY8EnFrlFDNGJcTUicY2rUylMgFMzILElZaPDbNLtr

and how to get these values in the view function

3
  • Note that you don't need {% csrf_token %} in your form if you are making GET requests. Commented May 16, 2018 at 10:55
  • 1
    Duplicate of stackoverflow.com/questions/3711349/… Commented Jul 26, 2019 at 2:36
  • Once you implemented the view which takes parameters from the GET, you can add a view with parameters in the URL that redirects to the query view. Commented Dec 13, 2022 at 9:23

1 Answer 1

5

The query string is never part of the routing. The view at /create-usecase/ will need to inspect request.GET directly or otherwise and operate based on that.

Sign up to request clarification or add additional context in comments.

3 Comments

so how to send the values of usecase_name, category and sub_category to another view function
Get them from request.GET.
I am not sure how its going to work because in the urls.py I have a path of pattern 'create-usecase/' which fire up the function called create_usecase I want to take the values from the form in the create-user template and transfer it to another function which is questions but to do that i must use another url pattern which i don't know how to use request.get

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.