diff --git a/scribeengine/controllers/post.py b/scribeengine/controllers/post.py index f0359f4..b750cb4 100644 --- a/scribeengine/controllers/post.py +++ b/scribeengine/controllers/post.py @@ -44,6 +44,7 @@ class PostController(BaseController): @authenticate(u'Add Posts') def new(self): c.page_title = u'New Post' + c.now = datetime.now() return render(u'/post/new.mako') @authenticate(u'Edit My Posts') @@ -60,13 +61,15 @@ class PostController(BaseController): @authenticate(u'Edit My Posts') def edit_POST(self, id=None): - url = utils.generate_url(c.form_values[u'title']) + url = utils.generate_url(c.form_values[u'edit-title']) if id is None: post = Post() post.user = c.current_user else: post = Session.query(Post).get(id) post.modified = datetime.now() + if c.form_values.get(u'authored') and c.form_values[u'authored']: + c.post.created = datetime(*time.strptime(c.form_values[u'authored'], '%Y/%m/%d %H:%M:%S')) post.title = c.form_values[u'title'] post.body = c.form_values[u'body'] if c.form_values[u'action'] == u'Save Draft': diff --git a/scribeengine/templates/post/edit.mako b/scribeengine/templates/post/edit.mako index 8ac397a..f8b6d48 100644 --- a/scribeengine/templates/post/edit.mako +++ b/scribeengine/templates/post/edit.mako @@ -18,6 +18,10 @@
+ + +
+
% if c.post.status == u'published': % else: diff --git a/scribeengine/templates/post/new.mako b/scribeengine/templates/post/new.mako index cca1e4e..f8b7176 100644 --- a/scribeengine/templates/post/new.mako +++ b/scribeengine/templates/post/new.mako @@ -7,15 +7,19 @@
- +
- +
- + +
+
+ +