pass multiple arguments in the url
<p>I'm trying to make a simple django app that interacts with the database. But I'm having trouble passing more than one parameter in the url.</p>

<p>To pass the arguments i do it this way:</p>

<pre><code>127.0.0.1:8000/REST/insert/?n=test/?x=2/?y=2/?z=True
</code></pre>

<p>And then in my <strong>views.py</strong> I get the parameters with:</p>

<pre><code>name = request.GET.get('n', '')
x = request.GET.get('x', '')
y = request.GET.get('y', '')
z = request.GET.get('z', '')
</code></pre>

<p>Clearly I'm doing it wrong. How can I fix it ?</p>

<p>What you want to do is not safe. Since you do an insert operation, request type should be POST and you should send the information as json.</p>

<p>Just write the data as json and put it to the body of the request.</p>

<p>In your view;</p>

<pre><code>import json
def your_view(request):
    body_unicode = request.body.decode('utf-8')
    data = json.loads(body_unicode) # This is a dictionary.
</code></pre>

python django django-urls