Ejemplo n.º 1
0
 def post(self, request):
     instance = Company.objects.get(owner_id=request.user.id)
     form = CompanyForm(request.POST, request.FILES, instance=instance)
     if form.is_valid():
         form.save()
         messages.add_message(request, messages.INFO, 'Информация о компании обновлена')
         return redirect('mycompany')
     return render(request, 'company/company-edit.html', {'form': form})
 def post(self, request, *args, **kwargs):
     form = CompanyForm(request.POST)
     if form.is_valid():
         company = form.save(commit=False)
         company.owner = request.user
         company.save()
         return redirect('my_company_and_my_vacancies')
Ejemplo n.º 3
0
 def post(self, request):
     form = CompanyForm(request.POST, request.FILES)
     if form.is_valid():
         company = form.save(commit=False)
         company.owner = User.objects.get(id=request.user.id)
         company.save()
         messages.add_message(request, messages.INFO, 'Компания успешно создана')
         return redirect('mycompany')
     return render(request, 'company/company-edit.html', {'form': form})
Ejemplo n.º 4
0
 def post(self, request):
     form = CompanyForm(request.POST)
     if form.is_valid():
         company = form.save(commit=False)
         company.owner = request.user
         company.save()
         messages.success(request, 'Кампания успешно создана!')
         return redirect('edit_company')
     messages.error(request, 'Вы ввели неверные данные!')
     return render(request, 'vacancies/vacancy.html', {'form': form})