pytask/taskapp/views/utils.py
changeset 540 b07d52d49db7
child 542 23bf9b4611cb
equal deleted inserted replaced
539:59e032315ab9 540:b07d52d49db7
       
     1 """Module containing taskapp views specific utility functions
       
     2 """
       
     3 
       
     4 __authors__ = [
       
     5     '"Madhusudan.C.S" <madhusudancs@fossee.in>',
       
     6     ]
       
     7 
       
     8 
       
     9 def get_intial_tags_for_chapter(textbook):
       
    10     """Returns the initial tag set for chapter/module for the textbook.
       
    11 
       
    12     Args:
       
    13         textbook: textbook entity for which the tags should be built.
       
    14     """
       
    15 
       
    16     tags1=textbook.tags_field
       
    17     tags = textbook.tags_field.split(',')
       
    18     rebuild_tags = []
       
    19     for tag in tags:
       
    20         tag.strip()
       
    21         if 'Textbook' not in tag:
       
    22             rebuild_tags.append(tag)
       
    23 
       
    24     initial_tags = ', '.join(rebuild_tags + ['Chapter'])
       
    25 
       
    26     return initial_tags