My template receives following the nested dictionary of general projects list with another dictionary of tags in another definition, together with a definition of a page view:
from django.views import View
class ProjectsView(Mixin, View):
def get(self, request, id = None, *args, **kwargs):
template = "pages/projects.html"
context = {
'title': "Projetos",
}
return render(request, template, context)
def general_projects_list(self, request, id = None, *args, **kwargs):
template = "pages/projects.html"
projects = {
0:
{
"Name": "Suru++ Pastas",
"Description": "Um executável em Bash de Unix e de BSD para substituir a cor das pastas dos temas de ícones Adwaita++, Suru++ e Yaru++",
"Colaboration": "Clonei o projeto o qual desenvolvi a fim de torná-lo compatível com os temas de ícones",
"Link": "https://github.com/gusbemacbe/suru-plus-folders",
"Tags": ["Makefile", "Shell"]
},
1:
{
"Name": "Icons Missing Request",
"Description": "Um executável que lê o tema de ícone utilizado e os arquivos de desktop de Linux para localizar se os ícones dos arquivos de desktop não existem no tema de ícone e gera uma lista de solicitação de ícones perdidos",
"Colaboration": "Colaborei com o projeto, traduzindo o executável em diversas línguas estrangeiras para facilitar os usuários não familiares com a língua inglesa no terminal",
"Link": "https://github.com/gusbemacbe/icons-missing-script",
"Tags": ["Shell", "Vala"]
},
2:
{
"Name": "Ooomox",
"Description": "Um aplicativo que gera as diferentes variações de cor para Linux, como GTK2, GTK3, GTK4 e terminal, e tambem modifica as cores dos ícones e das pastas dos temas de ícones para seu",
"Colaboration": "Colaborei com o projeto, adicionando as novas extensões de Adwaita++, Suru++ e Yaru++, e traduzindo o aplicativo em espanhol, francês, italiano, neerlandês e português",
"Link": "https://github.com/gusbemacbe/icons-missing-script",
"Tags": ["Makefile", "Python", "Shell"]
},
}
general_projects_dict = { 'projects': projects }
return render(request, template, { general_projects_dict })
I am having problem with a iteration through it. For example, when I am using the following code,
{% for value in general_projects_dict %}
{% for second_key, second_value in value.items %} {% comment %} 0, 1, 2, etc. {% endcomment %}
<h3>{{second_value.Name}}</h3> {% comment %} Name {% endcomment %}
<p>{{second_value.Description}}</p> {% comment %} Description {% endcomment %}
<p>{{second_value.Colaboration}}</p> {% comment %} Colaboration {% endcomment %}
<p><b>Etiquetas: </b>
{% for tag in second_value.Tags %}
<span>{{tag}}</span> {% comment %} Tags {% endcomment %}
{% endfor %}
<a href="{{value.Link}}" class="cyberpunk2077">Visitar</a> {% comment %} Link {% endcomment %}
{% endfor %}
</p>
{% endfor %}
Instead of it, the result does not appear in the page or Django does not render it.
Can anybody at least help to figure out how to iterate properly through this nested dictionary?