0
在我的模板,我用一個方法如下模型...Django模板能否傳遞參數?獲取當前用戶
模型的定義是這樣的:
class Category(model.Model):
title = models.CharField('title', max_length=255)
description = models.TextField('description', blank=True)
def pub_set(self):
...
return somedata
使用模板是這樣的:
{{ category.pub_set }}
我希望能夠獲得當前用戶在pub_set
他想要在他的模型方法中訪問請求(從模板) – 2011-01-31 03:18:44