Sorted the order of the menu items
This commit is contained in:
@@ -34,11 +34,11 @@ class Category(CommonInfo):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def active_children(self):
|
def active_children(self):
|
||||||
return self.children.filter(active=True)
|
return self.children.filter(active=True).order_by('name')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_samples(self):
|
def active_samples(self):
|
||||||
return self.samples.filter(active=True)
|
return self.samples.filter(active=True).order_by('name')
|
||||||
|
|
||||||
|
|
||||||
class Sample(CommonInfo):
|
class Sample(CommonInfo):
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ class HomeView(generic.ListView):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(HomeView, self).get_context_data(**kwargs)
|
context = super(HomeView, self).get_context_data(**kwargs)
|
||||||
context['active_samples'] = Sample.objects.filter(active=True)
|
context['active_samples'] = Sample.objects.filter(active=True).order_by('name')
|
||||||
context['parent_categories'] = Category.objects.filter(parent=None). \
|
context['parent_categories'] = Category.objects.filter(parent=None). \
|
||||||
filter(active=True)
|
filter(active=True).order_by('name')
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
@@ -33,11 +33,11 @@ class DetailView(generic.DetailView):
|
|||||||
model = Sample
|
model = Sample
|
||||||
template_name = 'three_d_viewer/detail.html'
|
template_name = 'three_d_viewer/detail.html'
|
||||||
parent_categories = Category.objects.filter(parent=None). \
|
parent_categories = Category.objects.filter(parent=None). \
|
||||||
filter(active=True)
|
filter(active=True).order_by("name")
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(DetailView, self).get_context_data(**kwargs)
|
context = super(DetailView, self).get_context_data(**kwargs)
|
||||||
context['active_samples'] = Sample.objects.filter(active=True)
|
context['active_samples'] = Sample.objects.filter(active=True).order_by('name')
|
||||||
context['parent_categories'] = Category.objects.filter(parent=None). \
|
context['parent_categories'] = Category.objects.filter(parent=None). \
|
||||||
filter(active=True)
|
filter(active=True).order_by('name')
|
||||||
return context
|
return context
|
||||||
|
|||||||
Reference in New Issue
Block a user