Small update

This commit is contained in:
ferdzo
2024-03-20 19:25:22 +01:00
parent 3865bd53f5
commit 2b7e9d1657
3 changed files with 10 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
{
"cmake.configureOnOpen": false
"cmake.configureOnOpen": false,
"python.pythonPath": ".venv\\Scripts\\python.exe"
}

View File

@@ -24,7 +24,7 @@ urlpatterns = [
path("insert/", view.InsertNew.insert, name="insert"),
path("edit/<int:pk>/", view.Update.as_view(), name="update"),
path("nalog/<int:id>/", view.Nalog, name="nalog"),
path("delete/<int:id>/", view.Delete.Delete, name="delete"),
path("delete/<int:id>/", view.Delete.delete, name="delete"),
path("done/", view.Done.as_view(), name="done"),
path("done/<int:id>/", view.Done.done_by_id, name="done"),
path("datatable/", view.DatatableView.as_view(), name="datatable"),

View File

@@ -38,7 +38,10 @@ class Update(generic.UpdateView):
def Nalog(request, id):
data = Insert.objects.get(id=id)
try:
data = Insert.objects.get(id=id)
except:
return HttpResponseRedirect("/")
template = "serviceCRM/nalog.html"
context = {"name": data.name, "phone": data.phone, "desc": data.description, "date": data.date}
return render(request, template, context)
@@ -57,9 +60,10 @@ class Done(SingleTableView):
context = {"name": req.name, "phone": req.phone, "desc": req.description, "date": req.date}
return HttpResponse(f"Report ID: {id} \nName: {req.name} \nPhone: {req.phone} \nDescription: {req.description} \n Note:{req.note} \nDate: {req.date} \nDone: {req.done} \nRepair: {req.repair} \n Plateno: {req.plateno} \n")
class Delete():
class Delete(generic.View):
model = Insert
def Delete(request, id):
def delete(request, id):
req = get_object_or_404(Insert, id=id)
req.delete()
return HttpResponseRedirect("/")