@login_required
def vacancy_update(request, vacancy_id=1):
obj = Vacancy.objects.get(id=vacancy_id)
form = VacancyForm(request.POST, instance=obj)
if request.method == 'POST':
if form.is_valid():
# form.save(commit=False)
form.save()
return HttpResponseRedirect('/accounts/profile/vacancy/all/')
user = request.user # не используется
# Избыточно
obj = Vacancy.objects.get(pk=vacancy_id)
form = VacancyForm(instance=obj)
args = {}
args.update(csrf(request))
args['form'] = form
return render_to_response('vacancy_update.html', args)
QGxvZ2luX3JlcXVpcmVkCmRlZiB2YWNhbmN5X3VwZGF0ZShyZXF1ZXN0LCB2YWNhbmN5X2lkPTEpOgogICAgb2JqID0gVmFjYW5jeS5vYmplY3RzLmdldChpZD12YWNhbmN5X2lkKQogICAgZm9ybSA9IFZhY2FuY3lGb3JtKHJlcXVlc3QuUE9TVCwgaW5zdGFuY2U9b2JqKQogICAgCiAgICBpZiByZXF1ZXN0Lm1ldGhvZCA9PSAnUE9TVCc6CiAgICAgICAgaWYgZm9ybS5pc192YWxpZCgpOgogICAgICAgIAkjIGZvcm0uc2F2ZShjb21taXQ9RmFsc2UpCiAgICAgICAgICAgIGZvcm0uc2F2ZSgpIAogICAgICAgICAgICByZXR1cm4gSHR0cFJlc3BvbnNlUmVkaXJlY3QoJy9hY2NvdW50cy9wcm9maWxlL3ZhY2FuY3kvYWxsLycpCiAgICAKICAgIHVzZXIgPSByZXF1ZXN0LnVzZXIgIyDQvdC1INC40YHQv9C+0LvRjNC30YPQtdGC0YHRjwogICAgCiAgICAjINCY0LfQsdGL0YLQvtGH0L3QvgogICAgb2JqID0gVmFjYW5jeS5vYmplY3RzLmdldChwaz12YWNhbmN5X2lkKQogICAgZm9ybSA9IFZhY2FuY3lGb3JtKGluc3RhbmNlPW9iaikKICAgIAogICAgYXJncyA9IHt9CiAgICBhcmdzLnVwZGF0ZShjc3JmKHJlcXVlc3QpKQogICAgYXJnc1snZm9ybSddID0gZm9ybQogICAgcmV0dXJuIHJlbmRlcl90b19yZXNwb25zZSgndmFjYW5jeV91cGRhdGUuaHRtbCcsIGFyZ3Mp