Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakser committed Nov 21, 2022
2 parents 1563eee + b1ada49 commit f016261
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions vacancy/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
path("<int:pk>/", VacancyDetail.as_view()),
path("<int:vacancy_id>/responses/", VacancyResponseList.as_view()),
path("responses/<int:pk>/", VacancyResponseDetail.as_view()),
path("responses/<int:pk>/accept", VacancyResponseAccept.as_view()),
path("responses/<int:pk>/decline", VacancyResponseDecline.as_view()),
path("responses/<int:pk>/accept/", VacancyResponseAccept.as_view()),
path("responses/<int:pk>/decline/", VacancyResponseDecline.as_view()),
]
9 changes: 8 additions & 1 deletion vacancy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework import generics, mixins, permissions, status
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from projects.models import Collaborator

from vacancy.filters import VacancyFilter
from vacancy.models import Vacancy, VacancyResponse
Expand Down Expand Up @@ -100,7 +101,13 @@ def post(self, request, pk):
return Response(status=status.HTTP_400_BAD_REQUEST)
vacancy_request.is_approved = True
vacancy = vacancy_request.vacancy
vacancy.project.collaborators.add(vacancy_request.user)
new_collaborator = Collaborator(
user=vacancy_request.user,
project=vacancy.project,
role=vacancy.role,
)
new_collaborator.save()
# vacancy.project.collaborator_set.add(vacancy_request.user)
vacancy.project.save()
vacancy_request.save()
return Response(status=status.HTTP_200_OK)
Expand Down

0 comments on commit f016261

Please sign in to comment.