Django: How to implement user profiles?
<p>I'm making a Twitter clone and trying to load profile pages. My logic was to start simple and find all tweets that match a certain author and load those tweets on a page as the user's profile. I really don't know where to start.</p>

<p>urls.py</p>

<pre><code>url(r'^users/(?P&lt;username&gt;\w+)/$', views.UserProfileView.as_view(), name='user-profile'),
</code></pre>

<p>models.py</p>

<pre><code>class Howl(models.Model):
    author = models.ForeignKey(User, null=True)
    content = models.CharField(max_length=150)
</code></pre>

<p>views.py</p>

<pre><code>class UserProfileView(DetailView):
    """
    A page that loads howls from a specific author based on input
    """
    model = get_user_model()
    context_object_name = 'user_object'
    template_name = 'howl/user-profile.html'
</code></pre>

<p>user-profile.html</p>

<pre><code>{% block content %}
&lt;h1&gt;{{user_object.author}}&lt;/h1&gt;
{% endblock %}
</code></pre>

<p>I'm currently getting an error that says "Generic detail view UserProfileView must be called with either an object pk or a slug." whenever I try something like localhost:8000/users/</p>

<p>I also went on the shell and tried</p>

<pre><code>Howl.objects.filter(author="admin")
</code></pre>

<p>But got </p>

<pre><code>ValueError: invalid literal for int() with base 10: 'admin'
</code></pre>

<p>Foreign key require model object or primary key of object.</p>

<p>pass the id of object whose username is "admin". use</p>

<pre><code>Howl.objects.filter(author=1) 
</code></pre>

<p>instead of</p>

<pre><code>Howl.objects.filter(author="admin") 
</code></pre>

<p>or you can use this one also</p>

<pre><code>user = User.objects.get(username = "admin")
Howl.objects.filter(author=user)
</code></pre>

python django