Coverage for common\templatetags\main_tags.py : 84%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Fandom, Chapter, Reading
def input_type(input):
""" Get notification list """
'paginator': paginator, 'is_paginated': is_paginated, 'position': position}
""" Get the stars to show """
def get_reading_of_user(chapter, user): """ Get the stars to show """
def get_all_different_languages(): """ Get all different languages """
'language').distinct()
def get_characters_of_fandom(fandom_id): """ Get the characters of a fandom """
def compare_if_equal(str1, str2): """ Compare the two strings """ if str(str1) == str(str2): return True else: return False
def get_fandoms(user_id): """ Get fandoms of one user """ list__user__id=user_id).values_list( 'fanfic__id', flat=True)) fanfic__id__in=fanfics).values_list('fandom__id', flat=True).distinct()
def get_new_chapters_for_user(user_id): """ Get the last four updated fanfics with new chapters for a user """ list__user__id=user_id).values_list('fanfic__id', flat=True) max_date = Chapter.objects.filter( fanfic__id=fanfic_id).aggregate(maxdate=Max('date'))['maxdate'] chapter = Chapter.objects.filter(fanfic__id=fanfic_id, date=max_date) if chapter.exists(): chapters.append(chapter.first())
def chapters_user_has_read(fanfic_id, user_id): """ How many chapters a user has read of a fanfic""" return Reading.objects.filter(user__id=user_id, chapter__fanfic__id=fanfic_id, read=True).count()
def get_user_recently_read_chapters(user_id): """ Get the last five read chapters for a user """ '-date')[:5]
def get_recently_added_fanfics(user_id): """ Get last four recently added fanfics """ '-date')[:4] |