自己兜 url 的話是這樣
class SiteInfo(models.Model):
CategoryId = models.ForeignKey('SiteCategory', db_column='CategoryId', db_index=True)
def show_category_in_list(self):
return u'{3}'\
.format(self.CategoryId._meta.app_label,
self.CategoryId._meta.object_name.lower(),
self.CategoryId.Id,
self.CategoryId.__unicode__())
show_category_in_list.allow_tags = True
順便注意要傳 html content 的話要設一下 allow_tags
沒有留言:
張貼留言