Nice code in Model of Django Python based framework

Member

lura.oberbrunner

by lura.oberbrunner , in category: Python , 8 days ago

Nice code in Model of Django Python based framework

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# In Django model
def processed_description(self):
    text = self.description. \
           replace('<table', '<div class="table">'
                             '<div class="bgtop"></div>'
                             '<div class="overflow"><table'). \
           replace('</table>', '</table></div>'
                               '<div class="bgbottom"></div>'
                               '</div>'). \
           replace('<th', '<th width="50%" align="left"')
    return text


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers