当前位置: 首页>>代码示例>>Python>>正文


Python Note.put方法代码示例

本文整理汇总了Python中models.Note.put方法的典型用法代码示例。如果您正苦于以下问题:Python Note.put方法的具体用法?Python Note.put怎么用?Python Note.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Note的用法示例。


在下文中一共展示了Note.put方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_note

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
    def _create_note(self, user, file_name, file_path):

        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))
        note.put()

        # Retrieve csv representing checklist items
        item_titles = self.request.get('checklist_items').split(',')

        for item_title in item_titles:
            if not item_title:
                continue
            # create a checklist instance
            item = CheckListItem(parent = note.key, title = item_title)
            # store each checklist
            item.put()
            # after storing it, we can access the key to append it to the note
            note.checklist_items.append(item.key)

        if file_name and file_path:
            url, thumbnail_url = self._get_urls_for(file_name)

            f = NoteFile(parent=note.key, name=file_name,
                         url=url, thumbnail_url=thumbnail_url,
                         full_path=file_path)
            f.put()
            note.files.append(f.key)

            # update the note entity with the checklist items
            note.put()  
开发者ID:vishalsanfran,项目名称:gcloud-apps,代码行数:33,代码来源:main.py

示例2: _create_note

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
    def _create_note(self, user, file_name, file_path):
        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))

        #note.put()

        item_titles = self.request.get('checklist_items').split(',')
        for item_title in item_titles:
            if not item_title:
                continue
            item = CheckListItem(title=item_title)
            #item.put()
            #note.checklist_items.append(item.key)

            note.checklist_items.append(item)

            #item = CheckListItemObject(title=item_title)
            #note.checklist_items.append(item)

        if file_name and file_path:
            url, thumbnail_url = self._get_urls_for(file_name)

            f = NoteFile(parent=note.key, name=file_name,
                         url=url, thumbnail_url=thumbnail_url,
                         full_path=file_path)
            f.put()
            note.files.append(f.key)

        note.put()
开发者ID:PacktPublishing,项目名称:Python-for-Google-App-Engine,代码行数:32,代码来源:main.py

示例3: note_insert

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
 def note_insert(self, note):
     if note.from_datastore:
         note_with_parent = note
     else:
         note_with_parent = Note(parent=main.get_parent_key(endpoints.get_current_user()),
                                 note = note.note, company_entity_key = note.company_entity_key)
          
     note_with_parent.put()
     return note_with_parent
开发者ID:11samype,项目名称:rose_career_fair,代码行数:11,代码来源:career_fair_api.py

示例4: create

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
 def create(self):
     if not users.get_current_user():
         webapp2.abort(401)
     form = NoteForm(self.get_locale(), self.request.POST, None)
     if self.request.POST and form.validate():
         note = Note(author=users.get_current_user(), **form.data)
         note.date = datetime.now()
         note.put()
         return self.redirect('/note/list')
     self.render_template('form.html', {'title': _('Note'), 'form': form, 'name': 'note'})
开发者ID:jkpluta,项目名称:jkpluta,代码行数:12,代码来源:notes.py

示例5: get

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
 def get(self):
     if 'X-AppEngine-Cron' not in self.request.headers:
         self.error(403)
     przedszkole = iPrzedszkole('<nazwa przedszkola>', '<uzytkownik>', '<haslo>')
     menu = przedszkole.jadlospis()
     if menu is None:
         menu = "Weekend :)"
     note = Note(id='jadlospis')
     note.kindergartenMenu = menu
     note.put()
     memcache.set(key='jadlospis', value=note.kindergartenMenu, time=expirationTime)
开发者ID:maciejszewczyk,项目名称:leniwy-ojciec-gae,代码行数:13,代码来源:main.py

示例6: post

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
   def post(self):
      user = users.get_current_user()
      if user is None:
         self.error(401)

      self._create_note(user) 

      note = Note(title = self.request.get('title'),content = self.request.get('content'))
      note.put()

      note = Note(parent=ndb.Key("User", user.nickname()), title=self.request.get('title'), content=self.request.get('content'))
      note.put()
 
      item_titles = self.request.get('checklist_items').split(',')
      for item_title in item_titles:
         item = CheckListItem(parent=note.key, title=item_title)
         item.put()
         note.checklist_items.append(item.key)
      note.put()

      logout_url = users.create_logout_url(self.request.uri)
      template_context = {
         'user': user.nickname(),
         'logout_url': logout_url,
      }
      self.response.out.write(template.render(template_context))

      def _render_template(self, template_name, context=None):
         if context is None:
            context = {}

         user = users.get_current_user()
         ancestor_key = ndb.Key("User", user.nickname())
         qry = Note.owner_query(ancestor_key)
         context['notes'] = qry.fetch()
 

         template = jinja_env,get_template(template_name)
         return template.render(context)

         self.response.out.write(self._render_template('main.html', template_context))

      @ndb.transactional
      def _create_note(self, user):
         note = Note(parent=ndb.Key("User", user.nickname()), title=self.request.get('title'), content=self.request.get('content'))
      note.put()

      item_titles = self.request.get('checklist_items').split(',')
      for item_title in item_titles:
         item = CheckListItem(parent=note.key, title=item_title)
         item.put()
         note.checklist_items.append(item.key)
      note.put()
开发者ID:TetsuoS,项目名称:pythonforgae,代码行数:55,代码来源:main.py

示例7: _create_note

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
 def _create_note(self,user):
     
     note = Note(parent=ndb.Key("User",user.nickname()),
                 title=self.request.get('title'),
                 content=self.request.get('content'))
     note.put()
     item_titles = self.request.get('checklist_items').split(',')
     for item_title in item_titles:
         item = CheckListItem(parent=note.key,title=item_title)
         item.put()
         note.checklist_items.append(item.key)
     note.put()
开发者ID:sky5497,项目名称:vantansy,代码行数:14,代码来源:main.py

示例8: POST

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
    def POST(self):
        user = users.get_current_user()
        form = form_add_note()
        object = {}
        if form.validates():
            object["success"] = True
            object["response"] = form.d.note
            note = Note(author=user, name=form.d.note, tags=form.d.ntag_list.split(","))

            note.put()
            object["message"] = "New note has been created"
        else:
            object["success"] = False
            object["errors"] = form.get_errors()
            object["message"] = "Note has not been created"
        return simplejson.dumps(object)
开发者ID:bluszcz,项目名称:bidoru,代码行数:18,代码来源:tags.py

示例9: post

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
    def post(self):
        user = self.user
        if user:
            content = self.request.get('note')
            note = Note()
            note.content = content
            note.user = user.key
            note.put()

            # show confirma   tion of successful post creation
            template_values = {
                'message': 'Note created successfully'
            }

            templates.render_page("notes/created", template_values, self)
        else:
            # error about login
            return

        return
开发者ID:tominovak33,项目名称:notes-webapp,代码行数:22,代码来源:handlers.py

示例10: list_notes

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
def list_notes():
    notes = Note.query()
    # Convert body of each note to marked-up markdown
    for note in notes:
        note.body = Markup(markdown.markdown(note.body))
    form = NoteForm()
    if form.validate_on_submit():
        note = Note(title=form.note_title.data,
                    slug=slugify(form.note_title.data),
                    body=form.note_body.data,
                    author=users.get_current_user())
        try:
            note.put()
            note_id = note.key.id()
            flash(u'Note %s saved.' % note_id, 'success')
            return redirect(url_for('list_notes'))
        except CapabilityDisabledError:
            flash(u'Datastore is in read-only mode.', 'info')
            return redirect(url_for('list_notes'))
    return render_template('dynamic_notes.html', notes=notes, form=form)
开发者ID:jshotwell,项目名称:jsn,代码行数:22,代码来源:views.py

示例11: post

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
    def post(self):
        user = users.get_current_user()
        if user is None:
            self.error(401)

        note = Note(parent=ndb.Key("User", user.nickname()),
                title=self.request.get('title'),
                content=self.request.get('content'))
        note.put()

        item_titles = self.request.get('checklist_items').split(',')
        for item_title in item_titles:
            item = CheckListItem(parent=note.key, title=item_title)
            item.put()
            note.checklist_items.append(item.key)

        note.put()

        logout_url = users.create_logout_url(self.request.uri)
        template_context = {
            'user': user.nickname(),
            'logout_url': logout_url,
        }
        self.response.out.write(self._render_template('main.html', template_context))
开发者ID:kogovsekm,项目名称:gae_notes,代码行数:26,代码来源:main.py

示例12: createNote

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import put [as 别名]
 def createNote(self, data):
     note = Note(author=users.get_current_user(), date=datetime.now(), **data)
     note.put()
     return note
开发者ID:jkpluta,项目名称:jkpluta,代码行数:6,代码来源:test_notes.py


注:本文中的models.Note.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。