title: How to display single/particular data record from database -django
body: <p>I want to display a particular data record from the database of a person who is logged in to the website. I have a default primary key in the migration. Other than that I don't have any of the primary or foreign keys. Below is the models.py and template codes.</p>
  <hr />
  <p><strong>models.py</strong></p>
  <pre><code>class Ticket(models.Model):
      Email = models.CharField(max_length=40)
     to = models.CharField(max_length=40)
     cc = models.CharField(max_length=50)
     subject = models.CharField(max_length=25)
     
     class Meta:
          db_table = 'ticket'
  
      def __str__(self):
          return self.Email
  </code></pre>
  <hr />
  <p>Following is the views which I had used before, that display's the whole data from the database.</p>
  <p><strong>Views.py</strong></p>
  <pre><code>def ticket(request):
    ticket = Ticket.objects.all()
    return render(request, 'web/ticket.html', {'ticket':ticket})
  </code></pre>
  <p>But I want to display data of the respective mail id</p>
  <hr />
  <p><strong>ticket.html</strong></p>
  <pre><code>{% for ticket in ticket %}
  &lt;fieldset id=&quot;first&quot;&gt;
      &lt;label for=&quot;From&quot;&gt;&lt;b&gt;From&lt;/b&gt;&lt;/label&gt; &amp;nbsp; &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;
       &lt;input type=&quot;text&quot; id=&quot;From&quot; name=&quot;From&quot; style=&quot;width:100%&quot; value=&quot;{{ ticket.Email }}&quot; required&gt; &lt;br&gt; &lt;br&gt;
  
       &lt;label for=&quot;To&quot;&gt;&lt;b&gt;To&lt;/b&gt;&lt;/label&gt; &amp;nbsp; &amp;nbsp;  &amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp;
       &lt;input type=&quot;text&quot; id=&quot;To&quot; name=&quot;To&quot; style=&quot;width:100%&quot; value=&quot;{{ ticket.to }}&quot; required&gt;&lt;br&gt; &lt;br&gt;
  
      &lt;label for=&quot;Cc&quot;&gt;&lt;b&gt;Cc&lt;/b&gt;&lt;/label&gt; &amp;nbsp; &amp;nbsp;  &amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp;
      &lt;input type=&quot;text&quot; id=&quot;Cc&quot; name=&quot;Cc&quot; style=&quot;width:100%&quot;  value=&quot;{{ ticket.cc }}&quot; required&gt;&lt;br&gt; &lt;br&gt;
  
      &lt;label for=&quot;Subject&quot;&gt;&lt;b&gt;Subject&lt;/b&gt;&lt;/label&gt; &amp;nbsp; &amp;nbsp;  &amp;nbsp; &amp;nbsp; &amp;nbsp;
      &lt;input type=&quot;text&quot; id=&quot;Subject&quot; name=&quot;Subject&quot; style=&quot;width:100%&quot; value=&quot;{{ ticket.subject }}&quot; required&gt;&lt;br&gt; &lt;br&gt;
   &lt;/fieldset&gt;
  {% endfor %}
  </code></pre>
  <hr />
  <p>Thanking you in advance. You will be highly appreciated if you could explain the needful code.</p>