title: How to use <username> in detailview for django 2.0
body: <pre><code>class Profile(models.Model):
  user = models.OneToOneField(User, on_delete=models.CASCADE)
  name = models.CharField(max_length=40, blank=True)
  bio = models.TextField(max_length=500, null=True, blank=True)
  
  def get_absolute_url(self):
      return reverse('userprofile:to_profile', args=[str(self.user.username)])
  </code></pre>
  
  <p>So I have made this model to save it as whatever.com/userprofile:to_profile/thisisusername</p>
  
  <p>And on url, I have</p>
  
  <pre><code>    path('accounts/profile/&lt;username&gt;/', ProfileDetailView.as_view(), name="to_profile"),
  </code></pre>
  
  <p>For the view, I have</p>
  
  <pre><code>class ProfileDetailView(DetailView):
  model = Profile
  template_name = "account/profile.html"
  </code></pre>
  
  <p>I do know that default DetailView takes pk and slug but whenever I try to pass the username with</p>
  
  <pre><code>pk_url_kwarg = "username"
  </code></pre>
  
  <p>I get an error </p>
  
  <pre><code>invalid literal for int() with base 10
  </code></pre>
  
  <p>Is there anyway we can use username for generic detailview? or is pk the only way to go?</p>