def create_id(request): if request.method == 'POST': form = ImportantDateForm(request.POST) if form.is_valid(): form.save() return redirect('cid:administration:id_list') else: form = ImportantDateForm() return render(request, 'cid/administration/create_id.html', { 'form': form })
def edit_id(request, id): idate = get_object_or_404(ImportantDate, id=id) if request.method == 'POST': form = ImportantDateForm(request.POST, instance=idate) if form.is_valid(): form.save() return redirect('cid:administration:id_list') else: form = ImportantDateForm(instance=idate) return render(request, 'cid/administration/edit_id.html', { 'form': form })