Commit 7108f538 authored by William Colmenares's avatar William Colmenares

fixed toggle message / added logs in case of errors

parent 1b893ac2
......@@ -7,11 +7,13 @@ from django.contrib import messages
from django.shortcuts import get_object_or_404, redirect
from rules.contrib.views import PermissionRequiredMixin
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from .models import Job, Application, Question, JobMessage
from .forms import JobForm, QuestionFormSet, ApplicationForm, AnswerForm, MessageForm
import logging
logger = logging.getLogger(__name__)
User = get_user_model()
class Index(TemplateView):
......@@ -242,7 +244,7 @@ class MyJobs(LoginRequiredMixin, ListView):
context['my_jobs_page'] = 'active'
return context
def send_message(request):
form = MessageForm(request.POST)
if form.is_valid():
......@@ -252,16 +254,24 @@ def send_message(request):
return redirect('jobs:conversation', pk=request.POST.get('receiver_id'))
def change_status(request):
job_id = request.POST.get('job_id')
if job_id is not None:
job = Job.objects.get(id=job_id)
if = False
job_obj = Job.objects.get(id=request.POST.get('job_id'))
if job_obj.posted_by == request.user:
if = False
else: = True
else: = True
"the user {} tried to toggle the job id {}. But it doesn't belong to him".format(
request.user, request.POST.get('job_id'))
except Job.DoesNotExist:
"the user {} tried to toggle the job id {} but it doesn't exists.".format(
request.user, request.POST.get('job_id'))
return redirect('jobs:my_jobs')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment