title: Page not found: No CustomUser matches the given query
body: <p><strong>Summary of project:</strong>
  (Sorry if this post is too long).
  You post a funny comment and people can read your post and then click a button to like you.  If you liked their post and they liked yours then you can both chat.</p>
  <p><strong>Summary of problem:</strong>
  Any time I click the &quot;like&quot; button on a post I get the following error:</p>
  <pre><code>    Page not found (404)
      Request Method: GET
      Request URL:    http://127.0.0.1:8000/vote/
      Raised by:  users.views.ProfileDetailView
      - No CustomUser matches the given query.  
  </code></pre>
  <p>So basically I cannot get the &quot;like&quot; button to save the current user + the post author to the &quot;liked&quot; table.  I've spent like two weeks reading the Django docs and trying different things in the view but now I'm just lost... I think it's my URL...</p>
  <p><strong>Setting.py</strong></p>
  <pre><code>AUTH_USER_MODEL = 'users.CustomUser'
  </code></pre>
  <p><strong>Users/models.py</strong></p>
  <pre><code>class CustomUser(AbstractUser):
      pass
  
  
  class Profile(models.Model):
      user = models.OneToOneField(
          get_user_model(),
          on_delete=models.CASCADE,
          primary_key=True,
      )
      first_name = models.CharField(max_length=100, blank=True)
    
  
      def __str__(self):
          return f'{self.user.username}'
  </code></pre>
  <p><strong>Userpost/models.py</strong></p>
  <pre><code>class Posts(models.Model):
      date_posted = models.DateTimeField(auto_now_add=True)
      author = models.ForeignKey(
          get_user_model(),
          on_delete=models.CASCADE,
      )
      caption = models.CharField(max_length=160, blank=True)
  
      def __str__(self):
          return self.caption
  </code></pre>
  <p><strong>Voting/Models.py</strong></p>
  <pre><code>class Like(models.Model):
      liker = models.ForeignKey(
          get_user_model(),
          on_delete=models.CASCADE,
          related_name='liker',
      )
      likee = models.ForeignKey(
          get_user_model(),
          on_delete=models.CASCADE,
          related_name='likee',
      )
      date_created = models.DateTimeField(default=timezone.now)
  
      def save(self, *args, **kwargs):
          super(Like, self).save(*args, **kwargs)
  </code></pre>
  <p><strong>voting.views.py</strong></p>
  <pre><code>from .models import Like
  from userposts.models import Posts
  
  CustomUser = get_user_model()
  
  def likePost(self, *arg, **kwargs):
      postauthor = request.GET[author_id]
      likeForm = LikeForm(request.POST)
      if likeForm.is_valid():
          likeForm = likeForm.save(commit=False)
          likeForm.liker = CustomUser.objects.get(id=self.request.user.id)
          likeForm.likee = postauthor
          likeForm.save()
  </code></pre>
  <p><strong>voting/urls.py</strong></p>
  <pre><code>from .views import likePost
  
  
  urlpatterns = [
      path('vote/', likePost, name='like_post'),
  ]
  </code></pre>
  <p><strong>Template</strong></p>
  <pre><code>{% block content %}
      {% for post in object_list %}
         &lt;div class=&quot;card&quot;&gt;
              &lt;div class=&quot;card-header&quot;&gt;
                  &lt;p&gt;{{ post.author }}&lt;/p&gt;
              &lt;/div&gt;
              &lt;div class=&quot;card-body&quot;&gt;
                  &lt;p&gt;{{ post.caption }}&lt;/p&gt;
                  &lt;p&gt;&lt;a class=&quot;btn btn-success&quot; href=&quot;{% url 'like_post' %}&quot;&gt;Like&lt;/a&gt;&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      {% endfor %}
  {% endblock %}
  </code></pre>
  <p><strong>Updated: users/view.py</strong></p>
  <pre><code>class ProfileDetailView(DetailView):
      model = Profile
      slug_field = &quot;username&quot;
      template_name = 'account/profile.html'
  
      def get_object(self):
          UserName = self.kwargs.get(&quot;username&quot;)
          return get_object_or_404(CustomUser, username=UserName)
  </code></pre>