title: Error Generic detail view must be called with either an object pk or a slug, even with the pk
body: <p>I'm trying to update records of a view which has a foreign key field, due to this I'm getting an error, since I tried to update another model without a foreign key field and it worked very well.</p>
  
  <p>There are other quetions like this, but in my case I'm passing the pk.</p>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code> urlpatterns = [
          url(r'^info/(?P&lt;studentpk&gt;\d+)/update/$', views.updatestudent.as_view(), name="updatestudent"),
  
  ]
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>class updatestudent(UpdateView):
      model = Student
      form_class = forms.studentform
      template_name = "temp/updatestudent.html"
  
      def get_success_url(self):
          return reverse("courses")
  </code></pre>
  
  <p><strong>updatestudent.html</strong></p>
  
  <pre><code>&lt;form action="" method="post"&gt;{% csrf_token %}
      {{ form.as_p }}
      &lt;input type="submit" value="Update" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Student(models.Model):
      classfk = models.ForeignKey(Class)
      name = models.CharField(max_length=100)
      birth_date = models.DateField('Birthdate')
  
      def __str__(self):
          return self.name
  </code></pre>
  
  <p><strong>error</strong></p>
  
  <pre><code>AttributeError: Generic detail view updatestudent must be called with either an object pk or a slug.
  </code></pre>