Я пытаюсь вернуть словарь из списка c. Однако ничего не отображается.
from django.views import generic
from .models import Application, Device
class ApplicationView(generic.ListView):
template_name = 'applications/applications.html'
context_object_name = 'applications'
context = {
"applications": Application.objects.all(),
"devices": Device.objects.all(),
}
def get_queryset(self):
return self.context
В шаблоне:
{% if applications %}
<ul>
{% for application in applications %}
<li>{{ application.name }}</li>
{% endfor %}
</ul>
{% else %}
<p>No applications found.</p>
{% endif %}