def __lt__(self, other): return title_sort_key(self.name) == title_sort_key(other.name)
def index(request): return render(request, 'tvshows/index.html', {'shows': sorted(Show.objects.all(), key=lambda x: title_sort_key(x.name))})
def index(request): shows = sorted(Show.objects.all(), key=lambda x: title_sort_key(x.name)) shows = [ListItem('/tvshows/%s' % show.pk, show.name, show.unwatched_episodes().count()) for show in shows if show.unwatched_episodes()] rows = chunks(shows, 2) return render(request, 'list.html', {'title': 'TV Shows', 'rows': rows})
def index(request): return render(request, 'tvshows/index.html', { 'shows': sorted(Show.objects.all(), key=lambda x: title_sort_key(x.name)) })