Conversation
hasjob/templates/delete.html
Outdated
| {% block content %} | ||
| <div class="sheet"> | ||
| <div class="section first"> | ||
| <h1>Delete this draft job post?</h1> |
…e inside model method
| form = Form() | ||
| if form.validate_on_submit(): | ||
| post.close() | ||
| post.closed_datetime = datetime.utcnow() |
There was a problem hiding this comment.
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
|
|
||
|
|
||
| class JobPost(BaseMixin, db.Model): | ||
| class JobPost(BaseMixin, db.Model): |
There was a problem hiding this comment.
Why is there an extra space here?
There was a problem hiding this comment.
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.
This is unnecessary because first_or_404() will do it for you.
| 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.
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.
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. |
|
Bibhas seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Fixes #337.