# Passing an argument to a view

**URL:** <https://forum.djangoproject.com/t/passing-an-argument-to-a-view/36319>\
**Category:** Getting Started\
**Created:** [November 9, 2024, 7:47pm UTC](https://forum.djangoproject.com/t/passing-an-argument-to-a-view/36319 "2024-11-09T19:47:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spidiffpaffpuff](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/spidiffpaffpuff/32/1557_2.png) [@Spidiffpaffpuff](https://forum.djangoproject.com/u/Spidiffpaffpuff)\
**Post date:** [November 9, 2024, 7:47pm UTC](https://forum.djangoproject.com/t/passing-an-argument-to-a-view/36319/1 "2024-11-09T19:47:25Z")

</div>

How do I pass an argument to a view without it showing up in the url?

This works fine:  
Template

```
<a href="{% url 'jobs:change_contract_status' job.pk %}">{{ job|contract_status_button }}</a>

```

urls.py

```
path('change_contract_status/<int:pk>/', v.change_contract_status, name='change_contract_status'),

```

How do I make this work?  
Template

```
<a href="{% url 'jobs:change_contract_status' job.pk return_path=request.path %}">{{ job|contract_status_button }}</a>

```

urls.py

```
????

```

I don’t want the second parameter to be a part of the url.

Alternatively is there another way to make a view return to the url it was called from?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 9, 2024, 8:03pm UTC](https://forum.djangoproject.com/t/passing-an-argument-to-a-view/36319/2 "2024-11-09T20:03:32Z")

</div>

You don’t. At least not a view that is going to be accessed with a GET request.

The only data that gets passed to the view is that which is presented in the request, either as part of the URL, as query data (`http://...?var=value`), or as POST data in a POST request.

(Well, I guess you could set the data value in a cookie/session, and handle that in your view, that _would_ be another option.)
