-
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?
Conversation
hasjob/templates/delete.html
Outdated
{% block content %} | ||
<div class="sheet"> | ||
<div class="section first"> | ||
<h1>Delete this draft job post?</h1> |
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.
"Delete this draft?"
…e inside model method
@@ -1011,12 +1011,29 @@ def close(domain, hashid, key): | |||
form = Form() | |||
if form.validate_on_submit(): | |||
post.close() | |||
post.closed_datetime = datetime.utcnow() |
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.
noticed that this datetime can be set inside close()
so moved there.
@jace made the necessary changes and tested. works good. |
hasjob/models/jobpost.py
Outdated
@@ -75,7 +75,7 @@ def has_starred_post(user, post): | |||
User.has_starred_post = has_starred_post | |||
|
|||
|
|||
class JobPost(BaseMixin, db.Model): | |||
class JobPost(BaseMixin, db.Model): |
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.
Why is there an extra space here?
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.
Not sure how this got here. fixed it.
hasjob/views/listing.py
Outdated
def delete(hashid, key): | ||
post = JobPost.query.filter_by(hashid=hashid).options(db.load_only('id', 'status')).first_or_404() | ||
if not post: | ||
abort(404) |
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.
This is unnecessary because first_or_404()
will do it for you.
hasjob/views/listing.py
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Flash a message that this post must be withdrawn or closed.
hasjob/models/jobpost.py
Outdated
|
||
def delete(self): | ||
self.status = POSTSTATUS.DELETED | ||
self.closed_datetime = datetime.utcnow() |
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.
@iambibhas where did we leave this one? |
@jace even I don't remember. This one was pending review I think. All the issues were fixed. Can get back to this once once we merge the statemanager one. Some workflow will change in this I guess. |
|
Fixes #337.