0
我正在製作一個管理工具,我需要在webapp2上列出所有的auth用戶。問題在於,auth模型的用戶模型沒有all()方法。如何在Webapp2上獲得所有Auth用戶?
那麼,我怎樣才能讓webapp2上的所有用戶?
我正在製作一個管理工具,我需要在webapp2上列出所有的auth用戶。問題在於,auth模型的用戶模型沒有all()方法。如何在Webapp2上獲得所有Auth用戶?
那麼,我怎樣才能讓webapp2上的所有用戶?
編輯,以展現更完整的例子:
from webapp2_extras.appengine.auth.models import User
class UserHandler(BaseHandler):
def get(self):
users = User.query().fetch()
self.render_response('templates/users.html', locals())
在模板中,users.html
,就可以通過users
可變環。
我的BaseHandler
包括方法render_response()
來呈現模板。
你能給這個答案增加一點更多的解釋嗎? –