fork download
  1. @login_required
  2. def vacancy_update(request, vacancy_id=1):
  3. obj = Vacancy.objects.get(id=vacancy_id)
  4. form = VacancyForm(request.POST, instance=obj)
  5.  
  6. if request.method == 'POST':
  7. if form.is_valid():
  8. # form.save(commit=False)
  9. form.save()
  10. return HttpResponseRedirect('/accounts/profile/vacancy/all/')
  11.  
  12. user = request.user # не используется
  13.  
  14. # Избыточно
  15. obj = Vacancy.objects.get(pk=vacancy_id)
  16. form = VacancyForm(instance=obj)
  17.  
  18. args = {}
  19. args.update(csrf(request))
  20. args['form'] = form
  21. return render_to_response('vacancy_update.html', args)
Runtime error #stdin #stdout #stderr 0.01s 7732KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 1, in <module>
NameError: name 'login_required' is not defined