title: django handling multiple id
body: <p>I have a model </p>
  
  <pre><code>class Notification(models.Model):
  
      user = models.ForeignKey(User)
      title = models.CharField(max_length=150)
      body = models.ForeignKey(Question)
      viewed = models.BooleanField(default=False)
  
      def __unicode__(self):
          return self.title
  </code></pre>
  
  <p>Here what I want to implement is get the notifications that are not viewed yet and when the user view the notification is should be set to viewed=True.</p>
  
  <p>My notification works perfect with the information and question title. When user clicks the notifications it goes to the detail view of the question. </p>
  
  <p>Here what I want the notification to be set as viewed when user goes to the detail view of the question. </p>
  
  <p>My template file is</p>
  
  <pre><code>{% for notification in notifications %}
  
  &lt;p&gt;&lt;a href="{% url "question-detail" notification.body.id %}"&gt;{{notification.title}}   &lt;/a&gt;&lt;/p&gt;
  {{notification.body}}
  
  
  {% endfor %}
  </code></pre>
  
  <p>View for my question detail view is:</p>
  
  <pre><code>class QuestionDetailView(DetailView):
  
      context = {}
  
      model = Question
      template_name = "question-detail.html"
  
      def get(self, request, pk, **kwargs):
  
          self.pk = pk
  
          return super(QuestionDetailView, self).get(request, pk, **kwargs)
  
      def get_context_data(self, **kwargs):
  
          context = super(QuestionDetailView,self).get_context_data(**kwargs)
  
          context['question'] = Question.objects.get(pk=self.pk)
  
  
          return context
  </code></pre>
  
  <p>and its url is: </p>
  
  <pre><code>url(r'^question/(?P&lt;pk&gt;\d+)',QuestionDetailView.as_view(), name="question-detail"),
  </code></pre>
  
  <p>Here I want to set the notification to be viewed=True. How can I get the id of the notification. In the url I am already getting the id of question.</p>