-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - deletion of draft #354
base: main
Are you sure you want to change the base?
Changes from 4 commits
997c933
a247056
fac0c60
030733d
439a293
4c7a661
e76b0c5
84221f4
2cad680
1cf4360
3a91c92
f700508
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% extends "sheet.html" %} | ||
{% from "baseframe/forms.html" import renderfield %} | ||
{% block title %}{{ post.headline|e }}{% endblock %} | ||
{% block content %} | ||
<div class="sheet"> | ||
<div class="section first"> | ||
<h1>Delete this draft?</h1> | ||
<h2>{{ post.headline }}</h2> | ||
<p> | ||
Deleted drafts will be gone forever, with no undo. Are you sure you want to delete? | ||
</p> | ||
<form method="POST" class="form-horizontal"> | ||
{{ form.hidden_tag() }} | ||
<button type="submit" class="btn btn-danger">Delete</button> | ||
<a class="btn btn-default" href="{{ post.url_for() }}">Cancel</a> | ||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1011,12 +1011,29 @@ def close(domain, hashid, key): | |
form = Form() | ||
if form.validate_on_submit(): | ||
post.close() | ||
post.closed_datetime = datetime.utcnow() | ||
db.session.commit() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. noticed that this datetime can be set inside |
||
return redirect(post.url_for(), code=303) | ||
return render_template("close.html", post=post, form=form) | ||
|
||
|
||
@app.route('/delete/<hashid>', methods=('GET', 'POST'), defaults={'key': None}, subdomain='<subdomain>') | ||
@app.route('/delete/<hashid>', methods=('GET', 'POST'), defaults={'key': None}) | ||
def delete(hashid, key): | ||
post = JobPost.get(hashid) | ||
if not post: | ||
abort(404) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unnecessary because |
||
if not post.admin_is(g.user): | ||
abort(403) | ||
if not post.is_draft(): | ||
return redirect(post.url_for(), code=303) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flash a message that this post must be withdrawn or closed. |
||
form = Form() | ||
if form.validate_on_submit(): | ||
post.delete() | ||
db.session.commit() | ||
return redirect(url_for('my_posts'), code=303) | ||
return render_template("delete.html", post=post, form=form) | ||
|
||
|
||
@app.route('/<domain>/<hashid>/reopen', methods=('GET', 'POST'), defaults={'key': None}, subdomain='<subdomain>') | ||
@app.route('/<domain>/<hashid>/reopen', methods=('GET', 'POST'), defaults={'key': None}) | ||
def reopen(domain, hashid, key): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
db.func.utcnow()
in both cases.