A List inside a list in django templates

Multi tool use
Multi tool use


A List inside a list in django templates



How do you render a list of user who have a list of their own objects related with foreign-key in Models. When I render in html it brings all list of all users in all users,



EDIT



Sorry for late reply, I rarely get time to get to my computer,



I have three models, Profile, Resume and Skills with the two related to Profile through foreign key...



VIEWS.PY


class ResumeList(ListView):
model = User_Profile
context_object_name = 'profile'
template_name = 'resume/list.html'
paginate_by = 6

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['resume'] = Resume.objects.all()
context['skill_list'] = Skill.objects.all()
return context



LIST.HTML


{% extends "base.html" %}
{% load static %}
{% block content %}
{% for obj in profile %}
{{ obj.first_name }}
{{ obj.last_name }}

{% for obj in resume %}
{{ obj.resume }}
{% endfor %}

{% for obj in skill_list %}
{{ obj.name }}
{% endfor %}

{% endfor %}
{% endblock %}



The Resume and Skill model loops are inside the profile loop but it displays all skills for all profiles...



When I change the get_context_data() to filter it brings error...
Thanks in advance...





Perhaps you better share that template then, right now it is rather unclear what is happening.
– Willem Van Onsem
Jun 27 at 13:08





and the view and models.
– Daniel Roseman
Jun 27 at 13:10










By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

bER,8hC2pzh9segaeq,uybH6 0UC sOz4Nb5TA45cEYlp0fEy hUpgZmSVrdkD580tBOoY S6cNz sdB 6ck1y381DV8CJePDMnnhM
hAujuEPSRsdlAoZ7BH0xZF JR8JfIVcILMU4hoYr8a317,Q7uphm1tViWWbqDtc45p,Duv

Popular posts from this blog

Delphi Android file open failure with API 26

.

Amasya