【问题标题】:How to edit (fetch/store) with Summernote textarea + Datastore GAE如何使用 Summernote textarea + Datastore GAE 编辑(获取/存储)
【发布时间】:2016-04-10 02:47:22
【问题描述】:

直到最近,我才能够将数据发布到我的数据存储区(Google App Engine)。我现在添加了 Summernote 所见即所得,现在我不再能够从数据存储中添加/获取数据。您认为问题出在哪里?

Main.py

class About(ndb.Model):
   text = ndb.StringProperty()

  #object   
   cv = About()

class MainHandler(webapp2.RequestHandler):
def get(self):
    title="Exercise"
    cv = About.get_or_insert('6684480941064192')
    text = cv.text

    template_vars={'title': title, 'text':text}
    template = JINJA_ENVIRONMENT.get_template('home.html')
    self.response.out.write(template.render(template_vars))

def post(self):
    cv = About.get_or_insert('6684480941064192')
    cv.text=self.request.get("texto")
    cv.put()
    self.redirect('/')

Html(Material design + bootstrp)

<form class="col s12" form action="/"  method="POST" id="frmPost" style="margin-top:25px; margin-bottom:10px;">
        <div class="row">

            <div class="panel panel-heading" style ="border-radius: 0px; background-color: #e57373;">
                <h3 class="panel-title" style ="color: white;">About...</h3>
            </div>

            <textarea rows="10" id="summernote" form="frmPost" name ="texto" style="margin-top:-10px; display:block;">
                    {{text}}
            </textarea>

        </div>


</form>


<script>
    $(document).ready(function() {
        $('#summernote').summernote({

        });
    });
</script>

【问题讨论】:

    标签: python google-app-engine summernote


    【解决方案1】:

    不确定summernote 是什么,但您可能需要将POST 您的数据返回到您HTML/JS 中某处的服务器。您有&lt;form&gt;,但似乎没有办法将您的数据提交回GAE。您可能需要 &lt;input type="submit" value="Save Data" /&gt; 在您的 &lt;form/&gt; 中的某处。

    【讨论】:

    • 嗨@Mihail Russu。提交按钮在那里。我只是没有在这里展示。 .
    • 请求是否发送到 GAE(您可以在 Chrome 的 DevTools 中看到)? GAE 是否正在处理请求?您可以在此处调试/记录处理并发布结果吗?
    • 让我在开发工具中追踪它并尽快恢复。谢谢
    猜你喜欢
    • 2014-03-22
    • 2016-05-30
    • 1970-01-01
    • 2016-07-13
    • 2015-06-14
    • 2014-12-13
    • 1970-01-01
    • 2011-07-09
    • 1970-01-01
    相关资源
    最近更新 更多