Я конечно только частично понял)
Оставь так. Сам наладишь со временем, когда расширять начнешь…
У меня не сильно лучше код)
return HttpResponseRedirect('/menu/')
return redirect('/menu/')
return render_to_response(“menu_edit.html”, {'title': title, ‘form’: form,}
return render(request, "menu_edit.html", {'title': title, 'form': form,}
lomach1. pk перенести из гета в тело URLa
Есть что-то, что можно соптимизировать?
class EditElement(UpdateView): template_name="menu_edit.html" form_class=Main_menu def get_context_data(self, **kwargs): context=super(EditElement, self).get_context_data(**kwargs) context['title']="Редактирование" return context