rascunho

commit 5a22c8430c2dd60e7730b02f38b6aacda2e4910a

Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>

document: allow to select the current frontmatter

 rascunho/blueprints/basic.py | 2 +-
 rascunho/types/document.py | 1 +


diff --git a/rascunho/blueprints/basic.py b/rascunho/blueprints/basic.py
index ab074db00e5eceb37736539029ed458b80a053c8..df270500416e8589c47576521ca98e4567f75327 100644
--- a/rascunho/blueprints/basic.py
+++ b/rascunho/blueprints/basic.py
@@ -8,7 +8,7 @@
 @basic.route("/", methods = ['GET', 'POST'])
 def index():
     if request.method == "GET":
-        doc = Document.query.order_by(Document.created_at.asc()).first()
+        doc = Document.query.filter(Document.frontmatter==True).first()
         return render_template('index.html', doc = doc)
     else:
         return create(request.form)




diff --git a/rascunho/types/document.py b/rascunho/types/document.py
index 51556c2fc4a6ef93a0220f4709b79b740b09346d..38fca97784ec2dca1ce4f29a621cda38c444f7f6 100644
--- a/rascunho/types/document.py
+++ b/rascunho/types/document.py
@@ -7,6 +7,7 @@
     id = sa.Column(sa.Integer, primary_key=True)
     sha = sa.Column(sa.String(40), nullable=False, index=True)
     content = sa.Column(sa.Unicode, nullable=False)
+    frontmatter = sa.Column(sa.Boolean, nullable=False)
 
     created_at = sa.Column(sa.DateTime, nullable=False)
     updated_at = sa.Column(sa.DateTime, nullable=False)