Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
How I can connect each name in list using id concept (python)

I created a list of users page and user profile page and I want when click on any name in the list it should show that user profile page.

in .html

<table class="table table-striped " id="table1"> 
<thead> 
<tr class="feed-bg text-white "> 
<th>Employee Name</th>
 <th>Employee Email</th>
 </tr>
 </thead> 
<tbody> 
{% for i in data_list %} 
<tr>
  <td>{{ forloop.counter }}</td>
  <td><a href="/user/edit_profile/"> {{i.employee_name}} </a></td>
  <td>{{i.employee_email}}</td>
 </tr> 
{% endfor %}
 </tbody> 
</table>

view.py of user list page

def user_list(request): 
data_list = [] 
get_user_details = CustomUser.objects.all() 
for i in get_user_details: 
data_dict = {} 
data_dict['employee_name'] = i.username 
data_dict['email'] = i.email 
data_list.append(data_dict) 
 return render(request, 'user_list.html', {'data_list': data_list})

urls

 path('user_list/', views.user_list, name='user_list'),
 path('profile/', views.profile, name='profile'), 

profile page

<div class="row r-bg mt-3"> 
<div class="row g-3">
{% for data in get_user_details %}
<div class="col-md-3"> 
<label for="username" class="form-label">Full Name *</label>
<input type="text" class="form-control" name="username" id="username" value="{{data.username}}"> </div> 
<div class="col-md-3"> 
<label for="email" class="form-label">Email *</label> 
<input type="email" class="form-control" name="email" id="email" value="{{data.email}}">
</div> 
</div>
<div class="row mt-5"> 
<div class="col-md-8 mt-3">
<button type="button" class="btn btn-outline-primary">save</button>
</div> 
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you must get profile_id in url.py like this:

path('profile/<int:profile_id>', views.profile, name='profile'), 

then call that in your template:

{% url profile 'profile' i.profile_id %}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda