Added dates back in, after I somehow lost them.
This commit is contained in:
parent
804cfea9c7
commit
424f406182
@ -44,6 +44,7 @@ class PostController(BaseController):
|
|||||||
@authenticate(u'Add Posts')
|
@authenticate(u'Add Posts')
|
||||||
def new(self):
|
def new(self):
|
||||||
c.page_title = u'New Post'
|
c.page_title = u'New Post'
|
||||||
|
c.now = datetime.now()
|
||||||
return render(u'/post/new.mako')
|
return render(u'/post/new.mako')
|
||||||
|
|
||||||
@authenticate(u'Edit My Posts')
|
@authenticate(u'Edit My Posts')
|
||||||
@ -60,13 +61,15 @@ class PostController(BaseController):
|
|||||||
|
|
||||||
@authenticate(u'Edit My Posts')
|
@authenticate(u'Edit My Posts')
|
||||||
def edit_POST(self, id=None):
|
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:
|
if id is None:
|
||||||
post = Post()
|
post = Post()
|
||||||
post.user = c.current_user
|
post.user = c.current_user
|
||||||
else:
|
else:
|
||||||
post = Session.query(Post).get(id)
|
post = Session.query(Post).get(id)
|
||||||
post.modified = datetime.now()
|
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.title = c.form_values[u'title']
|
||||||
post.body = c.form_values[u'body']
|
post.body = c.form_values[u'body']
|
||||||
if c.form_values[u'action'] == u'Save Draft':
|
if c.form_values[u'action'] == u'Save Draft':
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
<input type="text" name="tags" id="post-tags" class="form-text" value="${c.post.tags_list}" />
|
<input type="text" name="tags" id="post-tags" class="form-text" value="${c.post.tags_list}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
|
<label for="post-authored">Authored:</label>
|
||||||
|
<input type="text" name="post-authored" id="post-authored" class="form-text" value="${c.post.created.strftime('%Y/%m/%d %H:%M:%S')}" />
|
||||||
|
</div>
|
||||||
|
<div class="form-item">
|
||||||
% if c.post.status == u'published':
|
% if c.post.status == u'published':
|
||||||
<input type="submit" name="action" value="Save" class="form-button"/>
|
<input type="submit" name="action" value="Save" class="form-button"/>
|
||||||
% else:
|
% else:
|
||||||
|
@ -7,15 +7,19 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<!-- <label for="post-title">Title:</label> -->
|
<!-- <label for="post-title">Title:</label> -->
|
||||||
<input type="text" name="title" id="post-title" class="form-text" />
|
<input type="text" name="post-title" id="post-title" class="form-text" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<!-- <label for="post-body">Body:</label> -->
|
<!-- <label for="post-body">Body:</label> -->
|
||||||
<textarea name="body" id="post-body" class="form-textarea"></textarea>
|
<textarea name="post-body" id="post-body" class="form-textarea"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label for="post-tags">Tags:</label>
|
<label for="post-tags">Tags:</label>
|
||||||
<input type="text" name="tags" id="post-tags" class="form-text" />
|
<input type="text" name="post-tags" id="post-tags" class="form-text" />
|
||||||
|
</div>
|
||||||
|
<div class="form-item">
|
||||||
|
<label for="post-authored">Authored:</label>
|
||||||
|
<input type="text" name="post-authored" id="post-authored" class="form-text" value="${c.now.strftime('%Y/%m/%d %H:%M:%S')}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<input type="submit" name="action" value="Save Draft" class="form-button"/>
|
<input type="submit" name="action" value="Save Draft" class="form-button"/>
|
||||||
|
Reference in New Issue
Block a user