title: How to get the selected row's record from a table in django?
body: <p>I am new to django so I am sorry if this is a noob question.</p>
  <p>I have created a model <strong>&quot;Students&quot;</strong> in models.py and a view <strong>&quot;Add_Student&quot;</strong> for adding a new student, and another view <strong>&quot;Display_Students&quot;</strong> for displaying all the students. I have a table in which all the students are displaying perfectly with specific columns. But in the table, I added one more column that is <strong>&quot;Action&quot;</strong> and there is an eye-icon in that column. Now if someone click on that eye-icon so the complete information should be display in a new form/page. Displaying the information in a new form/page isn't the problem, but I don't know how it will work. Similarly, there will be an edit and delete icons.</p>
  <p>So here, my question comes, when I click on a eye-icon, how the django will get the desired row id from the table?</p>
  <pre><code>from django.db import models
  
  # Create your models here.
  
  class students(models.Model):
      firstname = models.CharField(max_length=50)
      lastname = models.CharField(max_length=50)
      fathername = models.CharField(max_length=50)
      city = models.CharField(max_length=50)
      country = models.CharField(max_length=50)
      state = models.CharField(max_length=50)
      zip = models.IntegerField(blank=True)
      address = models.CharField(max_length=100)
      contact =models.CharField(max_length=20)
      photo = models.FileField()
  </code></pre>
  <p><strong>Views.py</strong></p>
  <pre><code>from django.shortcuts import render, redirect
  from home.models import students
  
  # Create your views here.
  
  def index(request):
      return render(request, &quot;index.html&quot;)
  
  def Add_Student(request):
      if request.method == 'POST':
          firstname = request.POST.get('firstname')
          lastname = request.POST['lastname']
          fathername = request.POST['fathername']
          city = request.POST['city']
          country = request.POST['country']
          state = request.POST['state']
          zipcode = request.POST['zip']
          address = request.POST['address']
          contact = request.POST['contact']
          photo = request.POST['photo']
  
          Add_Student = students.objects.create(firstname=firstname, lastname=lastname, fathername=fathername, city=city,country=country, state=state, zip=zipcode, address=address, contact=contact, photo=photo)
          Add_Student.save()
          return redirect('Add_Student')
      else:
          return render(request, 'student/Add_Student.html')
  
  def Display_Student(request):
      Display_Student = students.objects.all()
      return render(request, 'student/display_students.html',{'Display_Student':Display_Student})
  </code></pre>
  <p><strong>display_student.html</strong></p>
  <p>In this page we can see the icons in last (Action) column. I want when someone click on the eye-con of the first row so it should get all the records from the table of  the selected first row. In there is another page where somemore information will display in the form of card in <strong>student_profile.html</strong> page</p>
  
              
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table id="example1" class="table table-bordered table-striped"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Student Name&lt;/th&gt;                   
                      &lt;th&gt;Father Name&lt;/th&gt;                               
                      &lt;th&gt;Contact&lt;/th&gt;                             
                      &lt;th&gt;Action&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
              
                  {% for student in Display_Student %}
                  &lt;tr&gt;
                      &lt;td&gt;{{student.firstname}} {{student.lastname}}&lt;/td&gt;
                      &lt;td&gt;{{student.fathername}}&lt;/td&gt;
                      &lt;td&gt;{{student.contact}}&lt;/td&gt;                
                      &lt;td&gt;                    
                        &lt;a href="student_profile"&gt;
                         &lt;i class="far fa-eye"&gt;&lt;/i&gt;
                                    
                      &lt;/a&gt;
                      &lt;a href="#"&gt;
                         &lt;i class="far fa-edit"&gt;&lt;/i&gt;
                                 
                      &lt;/a&gt;
                      &lt;a href="#"&gt;
                         &lt;i class="far fa-trash-alt"&gt;&lt;/i&gt;
                                     
                      &lt;/a&gt;
                        &lt;/td&gt;
                  &lt;/td&gt;
                  &lt;/tr&gt;
                  {% endfor %}
              
              &lt;/tbody&gt;
             
            &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><strong>student_profile.html</strong></p>
  <p>When someone click on that eye-icon the complete information should display in this page.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="card card-primary card-outline"&gt;
                &lt;div class="card-body box-profile"&gt;
                  &lt;div class="text-center"&gt;
                    &lt;img class="profile-user-img img-fluid img-circle"
                         src="{% static 'dist/img/user4-128x128.jpg' %}"
                         alt="User profile picture"&gt;
                  &lt;/div&gt;
  
                  &lt;h3 class="profile-username text-center"&gt;{{student.firstname}}&lt;/h3&gt;
  
                  &lt;p class="text-muted text-center"&gt;Software Engineer&lt;/p&gt;
  
                  &lt;ul class="list-group list-group-unbordered mb-3"&gt;
                    &lt;li class="list-group-item"&gt;
                      &lt;b&gt;Father Name&lt;/b&gt; &lt;a class="float-right"&gt;1,322&lt;/a&gt;
                    &lt;/li&gt;
                    &lt;li class="list-group-item"&gt;
                      &lt;b&gt;Contact&lt;/b&gt; &lt;a class="float-right"&gt;543&lt;/a&gt;
                    &lt;/li&gt;
                    &lt;li class="list-group-item"&gt;
                      &lt;b&gt;City&lt;/b&gt; &lt;a class="float-right"&gt;13,287&lt;/a&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
  
                  &lt;a href="#" class="btn btn-primary btn-block"&gt;&lt;b&gt;Follow&lt;/b&gt;&lt;/a&gt;
                &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>It will be highly appreciated if someone helped me. Please I am new and I have to do this and it is my last hope. Thank you</p>