Created
February 24, 2015 04:03
-
-
Save blizzarddreams/eddaa1f39f720c995d08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| from blog import models | |
| from flask.ext.mongoengine import MongoEngine | |
| app = Flask('blog') | |
| app.config["MONGODB_SETTINGS"] = {'DB': "FlaskBlog"} | |
| db = MongoEngine(app) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| class Post(db.Document): | |
| title = db.StringField(max_length=100,required=True) | |
| content = db.StringField(max_length=1000, required=True) | |
| pub_date = db.DateTimeField(default=datetime.datetime.now, required=True) | |
| slug = db.StringField(max_length=100,required=True) | |
| meta = { | |
| 'ordering': ['-pub_date'] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment