2013-12-15 14 views
0

我已經使用inherit插件將內容從一個頁面繼承到另一個頁面。但是,我只想在該佔位符上顯示10行並顯示「ReadMore」,而不是整頁,我已成功將Read More重定向到整頁。但是我不能只顯示10行內容。我怎樣才能做到這一點?在Django中應用Read_more cms

回答

0

django truncatewords,如果你仍然想堅持到線,看到一個custom template tag如何添加,可以延長Truncator class添加支持線,也看到它的使用在Django的default filters code

def _text_lines(self, length, truncate): 
    """ 
    Truncates a string after a certain number of lines. 
    """ 
    lines = self._wrapped.split('\n') 
    if len(line) > length: 
     lines = lines[:length] 
     return self.add_truncation_text('\n'.join(lines), truncate) 
    return '\n'.join(lines) 
+0

燦」用'django-cms'的'placeholder'標記完成 – pynovice