Closed NakitaOza closed 2 years ago
Hi @NakitaOza thanks for your PR, would you mind to explain how you've implemented that? Also there's some empty lines and commented code.
@edgarlatorre Hi, Apologies....Ill clean up the code.
The Implementation is as below:
1) Report button for each job:
File: jobs/templates/show.html , pythonjobs/static/css/base.css Added a "Report!" button, and gave it a title "Trouble?". Added css accordingly in base.css file.
2) Number of report clicks stored in db AND 3) If number of reports is equal to 5, send an email :
File: jobs/urls.py
As soon as the report button is clicked, url "
File: jobs/models.py A new Integer field named "report_clicks", measuring the number of times the report button was clicked for a particular job, was added to the db.
File: jobs/views.py A view function called "report" was created. It would get the current number of report_clicks from the db(job.report_clicks), add 1 to it, and save it back in the db. If the final number of clicks for that particular job is equal to 5, an email will be sent. The email id of the receiver is taken from the db (job.email) As discussed before, the SMTP sever used was SendGrid. I used my personal mail id to create an account on it. The sender's mail id : job-reports@pythonjobs.com Mail will be sent only when the number of reports is equal to 5, not more then that.
Once the report button is clicked, the user is redirected to "job-home" view ,i.e., the homepage (index.html) Hence, the return value of this view function is redirected to "job-home" url.
Please let me know if you need anything else.
Thanks a lot!!!
@edgarlatorre Hi, I have also added test for the implemented code to improve the coverage. Thanks!
Hi,
This implements #34 : 1) Report button for each job 2) Number of report clicks stored in db 3) If number of reports is equal to 5, send an email. SMTP server = SendGrid Mail sender email id = job-reports@pythonjobs.com Mail receiver email id = The email id mentioned in job posting