@@ -84,15 +84,15 @@ Install with the following commands:
84
84
pip install flask
85
85
pip install flask-script
86
86
pip install WTForms
87
- pip install https://github.com/hmarr/ mongoengine/tarball/dev
88
- pip install https://github.com/rozza/flask-mongoengine/tarball/master
87
+ pip install mongoengine
88
+ pip install flask_mongoengine
89
89
90
90
Continue with the tutorial to begin building the "tumblelog"
91
91
application.
92
92
93
93
.. _WTForms: http://wtforms.simplecodes.com/docs/dev/
94
94
.. _Flask-Script: http://pypi.python.org/pypi/Flask-Script
95
- .. _Flask-MongoEngine: http://github.com/rozza /flask-mongoengine
95
+ .. _Flask-MongoEngine: http://github.com/MongoEngine /flask-mongoengine
96
96
97
97
Build a Blog to Get Started
98
98
---------------------------
@@ -120,7 +120,7 @@ provides a development server and shell:
120
120
import os, sys
121
121
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
122
122
123
- from flaskext .script import Manager, Server
123
+ from flask.ext .script import Manager, Server
124
124
from tumblelog import app
125
125
126
126
manager = Manager(app)
@@ -157,10 +157,11 @@ Install the Flask_ extension and add the configuration. Update
157
157
.. code-block:: python
158
158
159
159
from flask import Flask
160
- from flaskext .mongoengine import MongoEngine
160
+ from flask.ext .mongoengine import MongoEngine
161
161
162
162
app = Flask(__name__)
163
163
app.config["MONGODB_DB"] = "my_tumble_log"
164
+ app.config["SECRET_KEY"] = "KeepThisS3cr3t"
164
165
165
166
db = MongoEngine(app)
166
167
@@ -203,6 +204,7 @@ In this application, you will define posts and comments, so that each
203
204
return self.title
204
205
205
206
meta = {
207
+ 'allow_inheritance': True,
206
208
'indexes': ['-created_at', 'slug'],
207
209
'ordering': ['-created_at']
208
210
}
@@ -442,7 +444,7 @@ and the :py:class:`DetailView` class to this file:
442
444
443
445
.. code-block:: python
444
446
445
- from flaskext .mongoengine.wtf import model_form
447
+ from flask.ext .mongoengine.wtf import model_form
446
448
447
449
...
448
450
@@ -501,7 +503,7 @@ create comments. Create a macro for the forms in
501
503
{% macro render(form) -%}
502
504
<fieldset>
503
505
{% for field in form %}
504
- {% if field.type == ' HiddenField' %}
506
+ {% if field.type in ['CSRFTokenField', ' HiddenField'] %}
505
507
{{ field() }}
506
508
{% else %}
507
509
<div class="clearfix {% if field.errors %}error{% endif %}">
@@ -619,7 +621,7 @@ following view is deliberately generic, to facilitate customization.
619
621
from flask import Blueprint, request, redirect, render_template, url_for
620
622
from flask.views import MethodView
621
623
622
- from flaskext .mongoengine.wtf import model_form
624
+ from flask.ext .mongoengine.wtf import model_form
623
625
624
626
from tumblelog.auth import requires_auth
625
627
from tumblelog.models import Post, Comment
@@ -831,6 +833,7 @@ class and create new classes for the new post types. Update the
831
833
return self.__class__.__name__
832
834
833
835
meta = {
836
+ 'allow_inheritance': True,
834
837
'indexes': ['-created_at', 'slug'],
835
838
'ordering': ['-created_at']
836
839
}
0 commit comments