def osimportnames_add(request): if request.method == 'POST': form = OsimportnameForm(request.POST) if form.is_valid(): osimportname = form.save(commit=False) osimportname.save() osimportname.logger(str(request.user), " OSIMPORTNAME_ADD_EXECUTED") messages.success(request, 'OS-Importname added') return redirect('/osimportnames') else: form = OsimportnameForm() debug_logger(str(request.user), " OSIMPORTNAME_ADD_ENTERED") return render(request, 'dfirtrack_main/osimportname/osimportnames_add.html', {'form': form})
def osimportnames_edit(request, pk): osimportname = get_object_or_404(Osimportname, pk=pk) if request.method == 'POST': form = OsimportnameForm(request.POST, instance=osimportname) if form.is_valid(): osimportname = form.save(commit=False) osimportname.save() osimportname.logger(str(request.user), " OSIMPORTNAME_EDIT_EXECUTED") messages.success(request, 'OS-Importname edited') return redirect('/osimportnames') else: form = OsimportnameForm(instance=osimportname) osimportname.logger(str(request.user), " OSIMPORTNAME_EDIT_ENTERED") return render(request, 'dfirtrack_main/osimportname/osimportnames_edit.html', {'form': form})