コード例 #1
0
 def answer(self, questionKey):
     def ancestored_create_factory(controller):
         return controller.meta.Model(parent=ndb.Key("Question", questionKey))
     self.scaffold.create_factory = ancestored_create_factory
     def set_redirect(controller, container, item):
         controller.scaffold.redirect = controller.uri(controller='questions', action='view', key=questionKey)
     self.events.scaffold_after_save += set_redirect
     returnKey = scaffold.add(self)
     time.sleep(0.1)     # in order to let item can be queried immediately after adding
     return returnKey
コード例 #2
0
    def add(self):
#         http = self.oauth.http()
#         service = build('oauth2', 'v2', http=http)
#         user_info = service.userinfo().get().execute()
        # more fields see here {@link https://developers.google.com/apis-explorer/#p/oauth2/v2/oauth2.userinfo.v2.me.get }
#         return "Hello, you are %s" % user_info['name']
        user = users.get_current_user()
        returnKey = scaffold.add(self)
        time.sleep(0.1)     # in order to let item can be queried immediately after adding
        print user 
        return returnKey
コード例 #3
0
 def add(self):
     AnswerForm = model_form(self.meta.Model, exclude=("votes",))
     self.scaffold.ModelForm = AnswerForm 
     returnKey = scaffold.add(self)
     time.sleep(0.1)     # in order to let item can be queried immediately after adding
     return returnKey
コード例 #4
0
ファイル: events.py プロジェクト: calvinti12/seat-geek
 def admin_add(self):
     return scaffold.add(self)
コード例 #5
0
ファイル: posts.py プロジェクト: jz1371/PROJECT_Simple-Quora
    def add(self):
#       a custom form exclude "views" property
        PostForm = model_form(self.meta.Model, exclude=('views',))
#       override model form of BasicModel
        self.scaffold.ModelForm = PostForm
        return scaffold.add(self)
コード例 #6
0
ファイル: events.py プロジェクト: richmondgozarin/seat-geek
 def admin_add(self):
     return scaffold.add(self)
コード例 #7
0
ファイル: posts.py プロジェクト: jz1371/PROJECT_Simple-Quora
 def add(self):
     #       a custom form exclude "views" property
     PostForm = model_form(self.meta.Model, exclude=('views', ))
     #       override model form of BasicModel
     self.scaffold.ModelForm = PostForm
     return scaffold.add(self)