title: Django, call the same view function with and without parameter
body: <p>I want to pass the image ID to the same view function and pass the Image to the template for display. </p>
  
  <p>In my analysis app urls.py I have used</p>
  
  <pre><code>path('', views.image_analysis, name='home'),
  path('&lt;int:id&gt;/', views.image_analysis, name='image_display'),
  </code></pre>
  
  <p>The view function is</p>
  
  <p><strong>What should I do there to get the id in the function. If I do like  def image_analysis(request, id) its giving error.</strong></p>
  
  <pre><code>def image_analysis(request):
      if request.method == 'GET':
          post_id = Image_upload.objects.get(id=id)
  
      all_images = Image_upload.objects.filter(user=request.user)
  
      return render(request,
                  'analysis/home.html',
                  {'images': all_images}
                  )
  </code></pre>
  
  <p>In the home.html template file.</p>
  
  <pre><code>{% block content %}
  
  &lt;div class="row"&gt;
      &lt;div class="col-sm-4"&gt;
          &lt;h2&gt;Images&lt;/h2&gt;
          &lt;ul class="list-group"&gt;
          {% for image in images %}
  
              &lt;li class="list-group-item"&gt;&lt;a href="{% url 'analysis:image_display' image.id %}"&gt;{{image.image_name}} -&lt;/a&gt; {{image.status}}&lt;/li&gt;
  
  
  
          {% endfor %}
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div class="col-sm-8"&gt;  Single Image will come here.&lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>The template HTML file is having 2 blocks the left one is with all the images from the user on clicking I want to display the image in the same place.</p>
  
  <p>Can you please help me.</p>