title: Why are usernames with uppercase letters causing errors Django
body: <p>I have a website where users are able to sign up and friend each other. However, I have noticed that users with uppercase letters in their names are causing errors when users try to friend them. It just comes up with a 404 page, and I have figured out why this is, just not how to fix it.</p>
  
  <p>models.py</p>
  
  <pre class="lang-py prettyprint-override"><code>class UserProfileInfo(models.Model):
      MALE = 'Male'
      FEMALE = 'Female'
  
      GENDER = [
          (MALE, 'Male'),
          (FEMALE, 'Female'),
      ]
  
      user = models.OneToOneField(User, on_delete=models.CASCADE,max_length=30)
      description = models.TextField(max_length=150)
      slug = models.SlugField(unique=True,allow_unicode=True)
      def __str__(self):
          return f'{self.user.username}'
  
      def get_absolute_url(self):
          kwargs = {
              'username':self.user.username,
          }
          return reverse('mainapp:view_profile_with_pk',kwargs=kwargs)
          # return reverse('mainapp:post_list')
  
      def save(self, *args, **kwargs):
          # slugl = self.slug.lower()
          self.slug = slugify(self.user.username)
          super().save(*args, **kwargs)
  </code></pre>
  
  <p>And my views for adding friends</p>
  
  <pre class="lang-py prettyprint-override"><code>class AddFriendRedirect(RedirectView):
      def get_redirect_url(self,*args,**kwargs):
          username = self.kwargs.get("username")
          obj = get_object_or_404(UserProfileInfo,slug=username)
          # print(f'OBJECT: {other}')
          # print(f'Current user: {self.request.user}')
          # user_profile = User.objects.get(username=username)
          url_ = obj.get_absolute_url()
          user = self.request.user
          user_ = self.request.user.username
          # user__ = 
          if user.is_authenticated:
              print("User is authenticated")
              if user in obj.friends.all():
                  obj.friends.remove(user)
                  obj.save()
              else:
                  obj.friends.add(user)
                  obj.save()
  
          return url_
  </code></pre>
  
  <p>And finally the url pattern</p>
  
  <pre class="lang-py prettyprint-override"><code>    # path('profile/&lt;str:username&gt;/add/',views.AddFriendRedirect.as_view(),name='add_friend'),
      re_path(r'^profile/(?P&lt;username&gt;[\w.@+-]+)/add/$(?i)',views.AddFriendRedirect.as_view(),name='add_friend'),
  </code></pre>
  
  <p>And now for the users with capital letters in their names.</p>
  
  <p>The reason for this I have come to realise is that the slug is in lowercases, but I can't figure out why I am getting this 404 error. </p>
  
  <p>Their profile page, which path is <code>path('profile/&lt;str:username&gt;/',views.view_profile,name='view_profile_with_pk'),</code>
  works just fine, with no errors. I am stumped as to why this isn't working.</p>