You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
502 B

from django.shortcuts import render
from django.views.generic import ListView
from .models import Specialization
class SpecListView(ListView):
model = Specialization
def get_context_data(self, **kwargs):
context = super(SpecListView, self).get_context_data(**kwargs)
root = Specialization.objects.get(pk=1)
context['root'] = root
context['children'] = root.get_children()
context['roots'] = Specialization.objects.root_nodes()
return context