Sorted the order of the menu items

This commit is contained in:
2014-01-21 15:59:23 +10:00
parent 4ffca36884
commit 07c6260bde
2 changed files with 7 additions and 7 deletions

View File

@@ -34,11 +34,11 @@ class Category(CommonInfo):
@property
def active_children(self):
return self.children.filter(active=True)
return self.children.filter(active=True).order_by('name')
@property
def active_samples(self):
return self.samples.filter(active=True)
return self.samples.filter(active=True).order_by('name')
class Sample(CommonInfo):

View File

@@ -19,9 +19,9 @@ class HomeView(generic.ListView):
def get_context_data(self, **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). \
filter(active=True)
filter(active=True).order_by('name')
return context
@@ -33,11 +33,11 @@ class DetailView(generic.DetailView):
model = Sample
template_name = 'three_d_viewer/detail.html'
parent_categories = Category.objects.filter(parent=None). \
filter(active=True)
filter(active=True).order_by("name")
def get_context_data(self, **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). \
filter(active=True)
filter(active=True).order_by('name')
return context