# Reverse for 'athlete\_profile' with arguments '('',)' not found. 1 pattern(s) tried: \['users/profile/athlete/(?P\<username\>\[^/\]+)/\\\\Z'\]

**URL:** <https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330>\
**Category:** Mystery Errors\
**Created:** [March 7, 2023, 1:23pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330 "2023-03-07T13:23:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 7, 2023, 1:23pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/1 "2023-03-07T13:23:19Z")

</div>

I’m trying to create a website where a host posts about sports events they will be organizing and an athlete can register themselves from the website itself. everything works fine but when I try to display the athlete profile to the athlete, it gives me an error as follows:

```auto
Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 4.1.7
Python Version: 3.11.0
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'users',
 'events']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template error:
In template C:\SHRUTI\SEM_6\PROJECT\Combat_conog\templates\base.html, error at line 80
   Reverse for 'athlete_profile' with arguments '('',)' not found. 1 pattern(s) tried: ['users/profile/athlete/(?P<username>[^/]+)/\\Z']
   70 : {% block css %}{% endblock %}
   71 : </head>
   72 : <body>
   73 : <nav>
   74 : <div>
   75 : <a href="{% url 'home' %}">Combat-Con</a>
   76 : </div>
   77 : <div>
   78 :       
   79 : {% if request.user.is_authenticated and user.is_athlete %}
   80 : <a href=" {% url 'users:athlete_profile' user.athlete.username %} ">Athlete Profile</a>
   81 : <a href="{% url 'users:user_logout' %}">Logout</a>
   82 : {% elif request.user.is_authenticated and user.is_host %}
   83 : <a href="{% url 'users:host_profile' %}">Host Profile</a>
   84 : <a href="{% url 'users:user_logout' %}">Logout</a>
   85 : {% else %}
   86 : <a href="{% url 'users:register' %}">Register</a>
   87 : <a href="{% url 'users:login' %}">Login</a>
   88 : {% endif %}
   89 : </div>
   90 : </nav>

Traceback (most recent call last):
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\core\handlers\exception.py", line 56, in inner
    response = get_response(request)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\users\views.py", line 12, in home
    return render(request, 'home.html')
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\backends\django.py", line 61, in render
    return self.template.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 175, in render
    return self._render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\loader_tags.py", line 157, in render
    return compiled_parent._render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\defaulttags.py", line 321, in render
    return nodelist.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\defaulttags.py", line 471, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\urls\base.py", line 88, in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\urls\resolvers.py", line 828, in _reverse_with_prefix
    raise NoReverseMatch(msg)

Exception Type: NoReverseMatch at /
Exception Value: Reverse for 'athlete_profile' with arguments '('',)' not found. 1 pattern(s) tried: ['users/profile/athlete/(?P<username>[^/]+)/\\Z']

```

i can’t figure out the reason for this error or can’t even locate what statement is causing this error. i have defined my view as follows:

```auto
@login_required
def athlete_profile(request, username):
    if request.user.is_athlete:
        #athlete = request.user.athlete
        #athlete = Athlete.objects.get(user=request.user)
        athlete = get_object_or_404(Athlete, username=username)
        return render(request, 'users/athlete_profile.html', {'athlete': athlete})
    else:
        return redirect('home')

```

my base template is:

```auto
<!DOCTYPE html>
<html>
<head>
  <title>{% block title %}COMBAT-CON{% endblock %}</title>
  {% block css %}{% endblock %}
</head>
<body>
  <nav>
    <div>
      <a href="{% url 'home' %}">Combat-Con</a>
    </div>
    <div>
      
      {% if request.user.is_authenticated and user.is_athlete %}
        <a href="{% url 'users:athlete_profile' user.athlete.username %}">Athlete Profile</a>
        <a href="{% url 'users:user_logout' %}">Logout</a>
      {% else %}
        <a href="{% url 'users:register' %}">Register</a>
        <a href="{% url 'users:login' %}">Login</a>
      {% endif %}
    </div>
  </nav>
    {% block content %}{% endblock %}
  </div>
</body>
</html>

```

my url to the profile:

```auto
path('profile/athlete/<str:username>/', views.athlete_profile, name='athlete_profile'),

```

I have been looking for solutions for 2 weeks now nothing I do helps. can someone please help me out with this??

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 7, 2023, 1:43pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/2 "2023-03-07T13:43:13Z")

</div>

Apparently you’re using a custom `User` model? If so, post it.

Also post your `Athlete` model.

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 7, 2023, 2:42pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/3 "2023-03-07T14:42:48Z")

</div>

models.py

```auto
from django.db import models
from django.contrib.auth.models import AbstractUser
from Combat_conog import settings
from django.contrib.auth.base_user import BaseUserManager
from django.utils.translation import gettext as _

class MyUserManager(BaseUserManager):
    """
    Custom user model manager where email is the unique identifier
    for authentication instead of usernames.
    """

    def create_user(self, email, password, **extra_fields):
        if not email:
            raise ValueError(_('Users must have an email address'))
        email = self.normalize_email(email)
        user = self.model(email=email, **extra_fields)
        user.set_password(password)
        user.save()
        return user

    def create_superuser(self, email, password, **extra_fields):
        extra_fields.setdefault('is_staff', True)
        extra_fields.setdefault('is_superuser', True)
        extra_fields.setdefault('is_active', True)

        if extra_fields.get('is_staff') is not True:
            raise ValueError(_('Superuser must have is_staff=True.'))
        if extra_fields.get('is_superuser') is not True:
            raise ValueError(_('Superuser must have is_superuser=True.'))
        return self.create_user(email, password, **extra_fields)

class MyUser(AbstractUser):
    objects = MyUserManager()
    is_athlete=models.BooleanField(default=True)
    is_host=models.BooleanField(default=False)

class Athlete(models.Model):
    GENDER_CHOICES = (
        ('M', 'Male'),
        ('F', 'Female'),
    )
    WEIGHT_CATEGORY_CHOICES = (
        ('Straw Weight', 'Straw Weight'),
        ('Fly Weight', 'Fly Weight'),
        ('Bantam Weight', 'Bantam Weight'),
    )
    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    name = models.CharField(max_length=100, default='FirstName MiddleName LastName')
    profile_picture = models.ImageField(upload_to='athlete_pics/', default='Combat_conog/default_img.png')
    contact_number = models.CharField(max_length=20, default='eg. 9843029462')
    date_of_birth = models.DateField(default='2011-1-1')
    age = models.IntegerField(default=12)
    gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
    height = models.DecimalField(max_digits=4, decimal_places=2, default=4)
    weight = models.DecimalField(max_digits=4, decimal_places=2, default=40)
    weight_category = models.CharField(max_length=20, choices=WEIGHT_CATEGORY_CHOICES)
    fighting_style = models.CharField(max_length=100, default='UNK')
    club_name = models.CharField(max_length=100, default='UNK')
    coach_name = models.CharField(max_length=100, default='UNK')
    record = models.CharField(max_length=100, default='UNK')

    def __str__ (self):
        return self.name
    

class Host(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='host')
    name = models.CharField(max_length=100)
    contact_number = models.CharField(max_length=20)
    organization_name = models.CharField(max_length=100)
    events_hosted = models.IntegerField(default=0)

    def __str__ (self):
        return self.name, self.pk

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 7, 2023, 2:53pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/4 "2023-03-07T14:53:18Z")

</div>

Your `Athlete` model doesn’t have a `username` field.

> [@shrutii2106](#):
>
> `<a href="{% url 'users:athlete_profile' user.athlete.username %}">Athlete Profile</a>`

So the expression `user.athlete.username` is always going to return `None`.

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 7, 2023, 2:55pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/5 "2023-03-07T14:55:02Z")

</div>

I get the same error even if i try to use fields like name and contact number

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 7, 2023, 2:56pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/6 "2023-03-07T14:56:41Z")

</div>

Then you need to verify that you have an instance of `Athlete` for that specific `user`, and that it contains data in those fields.

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 7, 2023, 2:58pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/7 "2023-03-07T14:58:47Z")

</div>

I have added some users from the admin page and i’m trying to view the profile of those users.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 7, 2023, 2:59pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/8 "2023-03-07T14:59:31Z")

</div>

But did you create the instances of the `Athlete` model?

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 7, 2023, 3:00pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/9 "2023-03-07T15:00:46Z")

</div>

yess, i have created 2 instances of the Athlete model

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 7, 2023, 3:02pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/10 "2023-03-07T15:02:55Z")

</div>

Verify that you have done all this correctly by using the Django shell to retrieve a user and its related Athlete instance.

Also, it may be helpful if you post the view that is trying to render this page.

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 8, 2023, 2:39pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/11 "2023-03-08T14:39:08Z")

</div>

This page is my base.html that’s why I don’t have a view for it. I used the django shell to retrieve the users, I got the desired output as follows:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/a/a9abd39fbe96622073684185a42ad7cb76e8cfac.png)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 8, 2023, 2:46pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/12 "2023-03-08T14:46:12Z")

</div>

> [@shrutii2106](#):
>
> This page is my base.html that’s why I don’t have a view for it.

If you are getting this error, it’s because you’re trying to render a page that is rendering (directly or indirectly) that template. What page are you trying to look at that is throwing that error?

> [@shrutii2106](#):
>
> I got the desired output as follows:

You’re showing four `MyUser` and only two `Athlete`. Get one of the `MyUser` instances that have a corresponding `Athlete` and try to print the fields of the related model.

e.g:

```auto
a_user = MyUser.objects.get(id=???) # Find an appropriate id
print(a_user.athlete)
print(a_user.athlete.name)
print(a_user.athlete.contact_number)

```

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 8, 2023, 3:12pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/13 "2023-03-08T15:12:33Z")

</div>

> [@KenWhitesell](#):
>
> If you are getting this error, it’s because you’re trying to render a page that is rendering (directly or indirectly) that template. What page are you trying to look at that is throwing that error?

its my home page. the view for it is:

```auto
def home(request):
    return render(request, 'home.html')

```

> [@KenWhitesell](#):
>
> You’re showing four `MyUser` and only two `Athlete`. Get one of the `MyUser` instances that have a corresponding `Athlete` and try to print the fields of the related model.
> 
> e.g:
> 
> ```auto
> a_user = MyUser.objects.get(id=???) # Find an appropriate id
> print(a_user.athlete)
> print(a_user.athlete.name)
> print(a_user.athlete.contact_number)
> 
> ```

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/3/3148add800813a6431f84c8fedfe60a19064bca0.png)  
works…?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 8, 2023, 3:13pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/14 "2023-03-08T15:13:27Z")

</div>

So what happens if you log on as that user? (That’s with having changed the

> [@shrutii2106](#):
>
> {% url ‘users:athlete\_profile’ user.athlete.username %}

to `{% url 'users:athlete_profile' user.athlete.name %}`

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 8, 2023, 3:26pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/15 "2023-03-08T15:26:55Z")

</div>

this is how my base.html after making some changes:

```auto
<html>
<head>
  <title>{% block title %}COMBAT-CON{% endblock %}</title>
</head>
<body>
  <nav>
    <div>
      <a href="{% url 'home' %}">Combat-Con</a>
    </div>
    <div>
      <a href="{% url 'events:event_list' %}">Events</a>
      {% if request.user.is_authenticated %}
        {% if request.user.is_athlete %}
          <a href="{% url 'users:athlete_profile' user.athlete.name %}">Athlete Profile</a>
        {% elif request.user.is_host %}
          <a href="{% url 'users:host_profile' user.host.name %}">Host Profile</a>
          {% endif %}  
        <a href="{% url 'users:user_logout' %}">Logout</a>
      {% else %}
        <a href="{% url 'users:register' %}">Register</a>
        <a href="{% url 'users:login' %}">Login</a>
      {% endif %}
    </div>
  </nav>
</body>
</html>

```

I’ve made the necessary changes in urls.py too. Whichever page I try to open, it shows me the same thing. I cannot even log in!

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 8, 2023, 3:31pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/16 "2023-03-08T15:31:39Z")

</div>

So with these changes, what error are you getting now?

(What change did you make in urls.py?)

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 8, 2023, 3:37pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/17 "2023-03-08T15:37:42Z")

</div>

urls.py:

```auto
from django.urls import path
from . import views
from . import models

app_name = 'users'

urlpatterns = [
    path('register/', views.register, name='register'),
    path('profile/athlete/create/', views.create_athlete, name='create_athlete'),
    path('profile/host/create/', views.create_host, name='create_host'),
    path('profile/athlete/<str:name>/', views.athlete_profile, name='athlete_profile'),
    path('profile/host/<str:name>/', views.host_profile, name='host_profile'),
    path('profile/hedit/<str:name>/', views.edit_host_profile, name='edit_host_profile'),
    path('profile/aedit/<str:name>', views.edit_athlete_profile, name='edit_athlete_profile'),
    path('login/', views.user_login, name='login'),
    path('logout/', views.user_logout, name='user_logout'),

```

error that i’m getting now:

```auto
 Reverse for 'athlete_profile' with arguments '('',)' not found. 1 pattern(s) tried: ['users/profile/athlete/(?P<name>[^/]+)/\\Z']
   71 : </head>
   72 : <body>
   73 : <nav>
   74 : <div>
   75 : <a href="{% url 'home' %}">Combat-Con</a>
   76 : </div>
   77 : <div>
   78 : <a href="{% url 'events:event_list' %}">Events</a>
   79 : {% if request.user.is_authenticated %}
   80 : {% if request.user.is_athlete %}
   81 : <a href=" {% url 'users:athlete_profile' user.athlete.name %} ">Athlete Profile</a>
   82 : {% elif request.user.is_host %}
   83 : <a href="{% url 'users:host_profile' user.host.name %}">Host Profile</a>
   84 : {% endif %}  
   85 : <a href="{% url 'users:user_logout' %}">Logout</a>
   86 : {% else %}
   87 : <a href="{% url 'users:register' %}">Register</a>
   88 : <a href="{% url 'users:login' %}">Login</a>
   89 : {% endif %}
   90 : </div>
   91 : </nav>

Traceback (most recent call last):
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\core\handlers\exception.py", line 56, in inner
    response = get_response(request)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\users\views.py", line 12, in home
    return render(request, 'home.html')
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\backends\django.py", line 61, in render
    return self.template.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 175, in render
    return self._render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\loader_tags.py", line 157, in render
    return compiled_parent._render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 167, in _render
    return self.nodelist.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\defaulttags.py", line 321, in render
    return nodelist.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\defaulttags.py", line 321, in render
    return nodelist.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\template\defaulttags.py", line 471, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\urls\base.py", line 88, in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
  File "C:\SHRUTI\SEM_6\PROJECT\Combat_conog\venv\Lib\site-packages\django\urls\resolvers.py", line 828, in _reverse_with_prefix
    raise NoReverseMatch(msg)

Exception Type: NoReverseMatch at /
Exception Value: Reverse for 'athlete_profile' with arguments '('',)' not found. 1 pattern(s) tried: ['users/profile/athlete/(?P<name>[^/]+)/\\Z']

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 8, 2023, 3:43pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/18 "2023-03-08T15:43:38Z")

</div>

Please post the `TEMPLATES` section of your settings.py file.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 8, 2023, 3:44pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/19 "2023-03-08T15:44:36Z")

</div>

Also, why did you change your urls.py?

---

<div class="post-metadata">

**Author:** ![shrutii2106](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrutii2106/32/12558_2.png) [@shrutii2106](https://forum.djangoproject.com/u/shrutii2106)\
**Post date:** [March 8, 2023, 3:46pm UTC](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330/20 "2023-03-08T15:46:15Z")

</div>

templates section of settings.py:

```auto
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

```

[Next page](https://forum.djangoproject.com/t/reverse-for-athlete-profile-with-arguments-not-found-1-pattern-s-tried-users-profile-athlete-p-username-z/19330.md?page=2)
