示例#1
0
 def post(self, request):
     response = request.POST
     v = Vacancy(
         state=response['position'],
         salary=response['salary'],
         organization=response['organization'],
         address=response['address'],
         employment=response['employment'],
         description=response['description'],
         skills=response['skills'],
         requirements=response['requirements'],
         duties=response['duties'],
         conditions=response['conditions'],
     )
     v.save()
     return redirect('vacancies_url')
示例#2
0
    def post(self, request):
        """ Создание карточки вакансии. """
        response = request.POST
        v = Vacancy(
            state=response['position'],
            salary=response['salary'],
            employment=response['employment'],
            description=response['description'],
            skills=response['skills'],
            requirements=response['requirements'],
            duties=response['duties'],
            conditions=response['conditions'],
        )

        if response.get('id_empl'):
            e = Employer.objects.get(id=response['id_empl'])
            v.employer = e
            v.organization = e.name
            v.address = e.address
            v.save()
            v.direction.add(Direction.objects.get(id=response['direction']))
            return redirect('employer_det_url', id_e=response['id_empl'])
        else:
            if response['organization'] in \
                    [e.name for e in Employer.objects.all()]:
                v.organization = Employer.objects.get(
                    name=response['organization']).name
                v.employer = Employer.objects.get(
                    name=response['organization'])
                v.save()
                v.direction.add(Direction.objects.get(id=response['direction']))
                return redirect('vacancies_url')
            else:
                e = Employer(name=response['organization'],
                             address=response['address'])
                e.save()
                v.organization = e.name
                v.address = e.address
                v.employer = e
                v.save()
                v.direction.add(Direction.objects.get(id=response['direction']))
                return redirect('vacancies_url')